Skip to main content

Posts

Showing posts from January, 2010

C# Nullable Types

Nullable Types: Nullable Types is a new concept (introduced in .Net 2.0), using which, a null value can be assigned to Value Types. Nullable types concept is not vital for Reference Types as these can be initialized to null; Nullable types are instances of the System.Nullable struct. A nullable type can represent the normal range of values for its underlying value type, and an additional null value.  For example, If an integer is used along with nullable type, it can be assigned any value (defined in its range) and in addition it can be assigned a null value as well.   Nullable Types Basics:   Nullable types have the following characteristics: Syntax: T?  value type (It is shorthand for System.Nullable , where T is a value type. The two forms can be used in-interchange.) T can be any value type including struct ;but, cannot be a reference type. Nullable Types Members: Each instance of a nullable type has two public read-only properties:   HasValue

C# Partial Feature:Classes and Methods

C# Partial Classes and Methods: One of the unique features of C# is the concept of Partial, extendable to definition of a Class or a Struct, an Interface or a method. Using this, the definition of any class, struct, interface of method can exist in two or more source files. Each source file contains a section of the type or method definition, and all parts are combined when the application is compiled. To split a class definition, partial keyword modifier is used. For Example: public partial class Pradeep { public void OnLeave () { } } public partial class Pradeep { public void InMeeting () { } } Here, it is valid to use the same name for the class and implement desired functionality separately. Finally, when compiled, the code is auto merged , giving a Final class named Pradeep, with the two methods that were defined separately. The partial keyword indicates that other parts of the class, struct, or interface can be defined in the namespace. Following are

DLL Hell Solution...Demistified

DLL Hell…Solved in .Net Framework Before NET Framework, DLL conflicts occurred because applications could not distinguish between incompatible versions of the same code. Type information contained in a DLL was bound only to a file name. An application failed to know if the types contained in a DLL were the same types as contained in existing application. Hence, a new version would overwrite an older version and break applications. .Net Framework introduced the Concept of Side-By-Side Execution to overcome this problem. This model introduced some vital changes in naming conventions of Dll and brought in the concept of versioning, wherein a new version of component/application can run with existing version, without any conflict. Side-by-side execution Features: Strong-named assemblies. Side-by-side execution uses strong-named assemblies to bind type information to a specific version of an assembly. This prevents an application or component from binding to an invalid versio

WCF..Why Communication Foundation?

WCF (Basics..for building effective Services) WCF:  Windows Communication Foundation It includes a collection of of .NET distributed technologies that have existed for long , but never got grouped under one name. WCF can be considered as collection of the following technologies. Web Services(ASMX) NET Enterprise Services MSMQ .NET Remoting Code written in WCF can interact across components, applications and systems. WCF is in accordance with SOA (Service Oriented Architecture). Following Sections provide the details of these ABCs. Addresses In WCF, every service has a unique address. The address provides two important elements A)     Location of the service B)      Transport protocol or transport schema used to communicate with the service.  The location indicates the name of the target machine, site, or network; a communication port, pipe, or queue; and an optional specific path or URI. WCF supports the following transport schemas: A)     HTTP