C# Programming

Miscellaneous Operators

C# Programming / Miscellaneous Operators

Miscellaneous Operators

What are C# Miscellaneous Operators?

C# miscellaneous operators are special operators that don't come under arithmetic, logical, relational, or bitwise categories. These operators are basically used for type checking, null handling, and memory referencing.

List of C# Miscellaneous Operators

There are few other important operators including sizeof and ? : supported by C#.

OperatorDescriptionExample
sizeof()Returns the size of a data type.sizeof(int), returns 4.
typeof()Returns the type of a class.typeof(StreamReader);
&Returns the address of an variable.&a; returns actual address of the variable.
*Pointer to a variable.*a; creates pointer named 'a' to a variable.
? :Conditional ExpressionIf Condition is true ? Then value X : Otherwise value Y
isDetermines whether an object is of a certain type.If( Ford is Car) // checks if Ford is an object of the Car class.
asCast without raising an exception if the cast fails.

Object obj = new StringReader("Hello");

StringReader r = obj as StringReader;

Technology
C# Programming
want to connect with us ?
Contact Us