Monday, August 22, 2005

C# Notes

C# was designed from the ground up, specifically to take advantage of the special features of the Common Language Runtime that runs .NET programs.

Its syntax is simple and benefits from automatic garbage collection, which reclaims any ‘spare’ memory.

.NET runtime system needs to be installed on any PC on which you wish to run your finished programs.

C# is case-sensitive.

If you don’t understand an error message, highlight it and press F1 for help.

PCPRO issue 131, pg 249.

Thursday, August 18, 2005

Programming C#

All the intrinsic types are value types except for the Object and String. All user defined types are reference types except for structs and enumerated types.

Objects on the heap are garbage collected sometime after the final reference to them is destroyed.

Integers are often faster than smaller types because modern CPUs are optimised for dealing with them. Further, because of paddling inserted for alignment, there is often no space gain to be had from smaller data types.

Implicit conversion: When small is converted to big
Explicit type cast: When big is converted to small.

Constant types:
Literal constant
Symbolic constant
Enumerations

Enumerations are formal types; therefore an explicit conversion is required to convert between an enumeration type and an integral type.

C# requires that all conditional expressions evaluate to a Boolean value.

goto
break
continue
return
throw

widget: in graphical user interfaces, a combination of graphic symbol and some program code to perform a specific function.

public
private: A’s methods only in class A
protected: A’s methods only in Class A’s and derived classes
internal: A’s methods and methods of any class in A’s assembly
internal protected: A’s, classes driven from A, any class in A’s assembly

Any Code not surrounded by #if and #endif is not affected by the pre-processor and is compiled into your program.

Encapsulation
Polymorphism
Inheritance

.NET Abbreviations

CTS: Common Type System
CLS: Common Language Specification
FCL: Frame Class Library
CLR: Common Language Runtime
RAD: Rapid Application Development
IDL: Interface Definition Language
MSIL or IL: Microsoft Intermediate Language