Difference between revisions of "Csharp programming syntax"

From WireCAD Online Help
Jump to: navigation, search
(Created page with "C# is a strongly typed language. That means that the variable type matters. You cannot assign a variable of one type to another of a different type without performing a type cast...")
 
Line 13: Line 13:
 
is the same as:
 
is the same as:
  
 +
//This is a comment and will not execute
 
  CallSomefunction(param1,
 
  CallSomefunction(param1,
 
  :param2,
 
  :param2,
Line 19: Line 20:
  
  
 
+
===Variable Declaration===
 
+
 
+
===Variable Declaration==
+
  
 
[scope] Type name = new Type(contructor params);
 
[scope] Type name = new Type(contructor params);

Revision as of 03:22, 23 December 2010

C# is a strongly typed language. That means that the variable type matters. You cannot assign a variable of one type to another of a different type without performing a type cast. C# is compiled into IL code that is then compiled just in time by the .NET framework. The .NET framework handles things like program execution and memory management. As a result C# is considered "managed code." C# is case sensitive so Var1 is different from var1.


Basic Syntax

White Space and Comments

C# uses the ; to terminate statements. As a result statements can have whitespace formatting characters(tabs, line feeds, carriage returns, etc.).

Example:

//This is a comment and will not execute
CallSomeFunction(param1, param2, param3);

is the same as:

//This is a comment and will not execute
CallSomefunction(param1,
:param2,
:param3);


Variable Declaration

[scope] Type name = new Type(contructor params);