Documente Academic
Documente Profesional
Documente Cultură
NET
Is the name Microsoft gives to its general vision of the future of computing. The view being of a world in which many applications run in a distributed manner across the Internet.
Just A Little C#
What Your Mother never Told You About .NET
C# versus Java
C# contains more primitive data types than Java. Unlike Java, C# can overload various operators. Like Java, C# gives up on the idea of multiple class inheritance. C# code does not require header files (as does C++).
C# versus C++
C# is about letting go of precise control, and letting the framework help you focus on the big picture. With the managed environment of .NET, you give up that level of control. You no longer control the lifetime of your object. C# has no destructor.
C# versus C++
Reference type variables sit on the stack, but they hold the address of an object on the heap, much like pointers in C++. Value types are passed to methods by value (a copy is made), while reference types are effectively passed by reference.
C# Pointers
In C#, pointers can only be declared to hold the memory addresses of value types (except in the case of arrays). Pointers are declared implicitly, using the 'dereferencer' symbol *, as in the following example:
int *p;
C# Pointers
*p can appear in integer assignments like the following:
*p = 5;
Unsafe Code
A major problem with using pointers in C# is that C# operates a background garbage collection process. In freeing up memory, this garbage collection is liable to change the memory location of a current object without warning.
Unsafe Code
To address the problem of garbage collection, one can declare a pointer within a 'fixed' expression. This 'pins' the location of the type pointed to - the memory location of the type therefore remains static, safe from garbage collection. Note that the fixed statement can only be used within the context of unsafe code.
Unsafe Code
Reference
http://www.softsteel.co.uk/tutorials/cSharp/ cIndex.html