How to use the sizeof operator and ternary operator of C #
In this article Xiaobian for you to introduce in detail "C# sizeof operator and ternary operator how to use", detailed content, clear steps, details handled properly, I hope that this "C# sizeof operator and ternary operator how to use" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.
Example
Using System
Namespace OperatorsAppl
{
Class Program
{
Static void Main (string [] args)
{
Instance of / * sizeof operator * /
Console.WriteLine ("size of int is {0}", sizeof (int))
Console.WriteLine ("size of short is {0}", sizeof (short))
Console.WriteLine ("size of double is {0}", sizeof (double))
/ * instance of ternary operator * /
Int a, b
A = 10
B = (a = = 1)? 20: 30
Console.WriteLine (the value of "b is {0}", b)
B = (a = = 10)? 20: 30
Console.WriteLine (the value of "b is {0}", b)
Console.ReadLine ()
}
}
}
When the above code is compiled and executed, it produces the following results:
The size of int is the size of 4short is the size of 2double is the value of 8b is the value of 30b is 20 read here, this "C# sizeof operator and ternary operator how to use" the article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more about the content of the article, welcome to pay attention to the industry information channel.