Expression And Types in C#

Expression

  • The combination of operator and operand.
  • We can use if condition, while, or dowhile that are required in the boolean condition.
  • The final results will come as either 0 (or) 1.
  • The goto statement cannot jump into blocks.
  • For each statement used (It can be used in Array).

Step 1: Open Visual Studio 2015,

Open Visual Studio 2015

Step 2: Click New Project and choose Visual C# then Click Console Application, type App Name and then click Ok,

New

Step 3: Write the coding for the normal addition of two values,

coding

Step 4: Click the start button to run the program,

run

Step 5: We can use more numbers of expression in our Program. The expression can run based on their precedence.The order of precedence is Bracket, Division, Multiplication, Addition, and Subtraction.

expression

Step 6: Click Start button to run the program,

run

Step 7: Use Another Expression,

Expression

Step 8: Output

Output

Type Systems in C#

  • Value Types
  • Reference Types

Value Types

  • It can contain the data directly
  • It cannot be null
  • It can use primitives, Enums, Structs

Example: int i=10 (It can directly contain the data)

Reference Types

  • It contains references to the objects
  • It may be null
  • It can use Classes, Interfaces, Arrays, Delegates

Example: String s="Good"; (The word "Good" can contain reference to s).