Saturday, December 17, 2011

What’s the difference between const and readonly?

You can initialize readonly variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare

public readonly string DateT = new DateTime().ToString().

List of Asked Interview Questions: C# .NET SQL MVC WCF Questions