Posts

Showing posts from April, 2008

ShortGuid - A shorter and url friendly GUID class in C#

Using the ShortGuid The ShortGuid is compatible with normal Guid's and other ShortGuid strings. Let's see an example: Guid guid = Guid.NewGuid(); ShortGuid sguid1 = guid; // implicitly cast the guid as a shortguid Console.WriteLine( sguid1 ); Console.WriteLine( sguid1.Guid ); This produces a new guid, uses that guid to create a ShortGuid, and displays the two equivalent values in the console. Results would be something along the lines of: FEx1sZbSD0ugmgMAF_RGHw b1754c14-d296-4b0f-a09a-030017f4461f Or you can implicitly cast a string to a ShortGuid as well. string code = "Xy0MVKupFES9NpmZ9TiHcw"; ShortGuid sguid2 = code; // implicitly cast the string as a shortguid Console.WriteLine( sguid2 ); Console.WriteLine( sguid2.Guid ); Which produces the following: Xy0MVKupFES9NpmZ9TiHcw 540c2d5f-a9ab-4414-bd36-9999f5388773 Read More ...... http://www.singular.co.nz/blog/archive/2007/12/20/shortguid-a-shorter-and-url-friendly-guid-in-c-sharp.aspx

Intro to Constructors in C#

Constructor in C# : Broadly speaking, it is a method in the class which gets executed when its object is created. Usually we put the initialization code in the constructor. Writing a constructor in the class is damn simple, have a look at the following sample : public class mySampleClass { public mySampleClass() { // This is the constructor method. } // rest of the class members goes here. } When the object of this class is instantiated this constructor will be executed. Something like this : mySampleClass obj = new mySampleClass() // At this time the code in the constructor will // be executed Constructor Overloading : C# supports overloading of constructors, that means we can have constructors with different set of parameters. So our class can be like this : public class mySampleClass { public mySampleClass() { // This is the no parameter constructor method. // First Constructor } public mySampleClass(int Age) { // This is the constructor with one parameter. // Second Constructor } p...

Assembly Binding Process

Image

Master Page in asp.net 2.0

Master pages let you make a consistent layout for your application, you can make one master page that holds the layout/look & feel and common functionality of your whole application and upon this master page, you can build all the other pages, we call these pages Content Pages. Visit these links for details http://www.devx.com/dotnet/Article/18042 http://www.codeproject.com/KB/aspnet/masterpages.aspx