public delegate void DotNetFunHandler(); public event DotNetFunHandler DotNetFunEvent; if (DotNetFunHandler != null) DotNetFunHandler();
C# Reference
XML Web Services
Contact Us
Feeds
C# - C# Tips
Search:
Tips found: 14
 
The lifetime of value is tied to the scope in which it is declared whereas the lifetime of an object is not tied to the scope in which it is created. Values typically have very short lifetimes whereas objects typically have long lifetimes.
The compiler automatically translates a destructor into an override of the System.Object.Finalize method.
Try to avoid using destructors except when you really need them.
Constants can be of any intrinsic or enumerated type, but not of a user-defined type or an array and contain fixed values.
The default data type for enums is Integer (int), but can be any of the integral numeric data types (in Visual C#: byte, short, int, long).
It is not necessary to supply values for the members of an enumerator. If you choose to not designate specific values, they will be assigned default values numbered sequentially starting from zero.
When using the For Each (foreach) syntax, the reference that the iteration variable holds to the members of the collection is read-only. Thus, you cannot use For Each (foreach) to make changes to items contained in an array or collection.
The constructor is the first method that is run when an instance of a type is created. It is a method with the same name as the class. Constructors can never return a value, and can be overridden to provide custom intitialization functionality.
If you are creating a delegate to an instance method, you must initialize the delegate within a method. Delegates to static methods can be initialized outside a method.
Encapsulation is the concept that the implementation of an object is independent from its interface. Put another way, an application interacts with an object through its interface, which consists of its public properties and methods. As long as this interface remains constant, the application can continue to interact with the component, even if the implementation of the interface has been completely rewritten between versions.
Polymorphism is the ability of different classes to provide different implementations of the same public interfaces. In other words, polymorphism allows methods and properties of an object to be called without regard for the particular implementation of those members.
An interface is a contract for behavior. Essentially, it defines the members a class should implement, but states nothing at all about the details of that implementation. An object can implement many different interfaces, and many diverse classes can implement the same interface. All objects implementing the same interface are capable of interacting with other objects through that interface.
Inheritance allows you to incorporate all of the functionality of a previously defined class into a new class and implement different members as needed. A class that inherits another class is said to derive from that class, or to inherit from that class. A class can directly inherit from only one class, which is called the base class. The new class has all of the same members as the base class, and additional members can be added as needed.
Overloads are multiple methods with the same name. Overloaded methods must have different signatures, but need not have the same return type nor access level. When an overloaded method is called, the run time examines the types of the arguments supplied in a method call. It then matches the argument list with the available overload signatures and calls the one that fits.

 
COPYRIGHT/DISCLAIMER | CONTACT US