AND, OR and binary operations on variables

C# is not the same as C or C++!!!!!  Simple byte operations for example do not result in a byte result, they often result in an Int32 result An example binary operation This will generat the error "Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast)": TxData[ByteIndex++] = […]

Read More

static

Class static variables A static variable shares the value of it among all instances of the class. static Local Variables in C# Nope, you can't have a static local variable in a method in C#, get over it.  Declare them in the class. The reason – C# is an Object Oriented programing language, C (which […]

Read More

Constants

You have to use constants within a class.  So like this: public const int MY_NUMBER = 9;   You'd need to put it in a class somewhere, and the usage would be ClassName.MY_NUMBER Number Defines public const int SOFTWARE_VERSION = 42; const int SOFTWARE_VERSION = 42; String Defines public const string MY_THINGS_PATH = "c:\\windows\\"; const […]

Read More

Variables

The structure below shows the various basic types of C# and the types they map to in the .Net framework. C# Short Name .Net Class Declaration Description bool Boolean bool isValid = true; 8 bit true or false sbyte SByte sbyte b = -1 signed 8 bit integer byte Byte byte b = 1; 8 bit […]

Read More