Skip to main content

Posts

Showing posts from January, 2013

Const and Readonly keyword

Both these words play a very important role in defining constants in an application (C#). At one sight, it seems like, both are same but exactly it is not he case. Let's understand one by one to get the clear picture. The word const itself means, it will never change. If you are specifying any variable as a  const t hat means the value of the variable is never going to change inside the application. How we declare a constant is, by using a  const  keyword. Basically, one can define  const  only on the primitive types, like int, double, etc. One should make sure that the value should be assigned at the time of declaration itself and another important thing is whatever value is set for  const  variable, that value will be set at the compile time itself and this value will get stored inside a .dll or an .exe. In later part, I'll show u on how we can see this value inside a dll or an exe using an Ildasm. Sample code to define  const   variable is as: Another key

Silly but useful stuff - Part 2 (ASP.Net)

Using StartMode Attribute Every time we update our site, IIS must recompile it during the first request, so the initial request takes significantly longer than subsequent ones. An easy solution for this is to tell IIS to automatically recompile our site as part of the update process. And this can be achieved using the startMode attribute in the ApplicationHost.config file. In essence, we can say, by using startMode attribe, one can reduce the initial load time of an ASP.Net site. Hope it helps :)