Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
GeneralRe: If C# is Microsoft's answer to SUN's Java, then is C# Platform independent? Pin
Link26001-Jun-03 6:09
Link26001-Jun-03 6:09 
QuestionHow do I draw graphics on the StatusBar ? Pin
JeffSayHi30-May-03 21:27
JeffSayHi30-May-03 21:27 
AnswerRe: How do I draw graphics on the StatusBar ? Pin
James T. Johnson31-May-03 18:16
James T. Johnson31-May-03 18:16 
AnswerRe: How do I draw graphics on the StatusBar ? Pin
Manster2-Jun-03 9:45
Manster2-Jun-03 9:45 
GeneralHello Pin
Hussein Zahran30-May-03 8:04
Hussein Zahran30-May-03 8:04 
GeneralRe: Hello Pin
Jon Newman30-May-03 8:41
Jon Newman30-May-03 8:41 
GeneralRe: Hello Pin
Paul Watson31-May-03 4:11
sitebuilderPaul Watson31-May-03 4:11 
Generalconst vs static readonly Fields Pin
Nathan Blomquist30-May-03 6:46
Nathan Blomquist30-May-03 6:46 
Hello,

I was just wondering if anyone has a good explanation for the differences between static readonly fields and const fields?

The differences I can come up with are:

1. const fields can only be initialized at declaration
2. static readonly can be initialized at declaration or in a static constructor (either directly in the static constructor or through another method called from the static constructor using ref or out)
3. static readonly are changeable at runtime (app start); meaning each time the app is run this field can change
Example:
public class myClass
{
  static readonly DateTime m_MyStart = DateTime.Now; // this will always be different...
}

4. const fields are hard coded into the MSIL at compile time; meaning an app might use a constant from an assembly and later that assembly might change the constants, but the app doesn't realize the update until the app itself is rebuilt. (Can anyone rephrase this better than that? I suck at trying to describe this...)

Anyone else have differences or corrections to these?

Thanks,
Nathan

---------------------------
Hmmm... what's a signature?
GeneralRe: const vs static readonly Fields Pin
Eric Gunnerson (msft)30-May-03 13:19
Eric Gunnerson (msft)30-May-03 13:19 
GeneralApplication & Window positions Pin
BenjaminAlicea30-May-03 5:46
BenjaminAlicea30-May-03 5:46 
GeneralRe: Application & Window positions Pin
KingTermite30-May-03 6:38
KingTermite30-May-03 6:38 
GeneralRe: Application & Window positions Pin
Andy Smith30-May-03 8:43
Andy Smith30-May-03 8:43 
GeneralCombo boxes Pin
totig30-May-03 4:23
totig30-May-03 4:23 
GeneralRe: Combo boxes Pin
Carl Mercier30-May-03 5:37
Carl Mercier30-May-03 5:37 
GeneralRe: Combo boxes Pin
James T. Johnson31-May-03 18:36
James T. Johnson31-May-03 18:36 
GeneralSession problems Pin
Peter Kiss30-May-03 1:51
Peter Kiss30-May-03 1:51 
GeneralRe: Session problems Pin
Rocky Moore30-May-03 23:19
Rocky Moore30-May-03 23:19 
GeneralRe: Session problems Pin
Peter Kiss31-May-03 0:49
Peter Kiss31-May-03 0:49 
GeneralRe: Session problems Pin
Rocky Moore1-Jun-03 4:42
Rocky Moore1-Jun-03 4:42 
GeneralRe: Session problems Pin
Peter Kiss1-Jun-03 5:31
Peter Kiss1-Jun-03 5:31 
GeneralMethod override Pin
BenjaminAlicea30-May-03 1:15
BenjaminAlicea30-May-03 1:15 
GeneralRe: Method override Pin
BenjaminAlicea30-May-03 5:20
BenjaminAlicea30-May-03 5:20 
GeneralRe: Method override Pin
BenjaminAlicea30-May-03 7:11
BenjaminAlicea30-May-03 7:11 
QuestionCan I use splitter to make a ruler ? Pin
JeffSayHi30-May-03 0:20
JeffSayHi30-May-03 0:20 
GeneralCustom controls problems Pin
Oleksandr Kucherenko29-May-03 23:56
Oleksandr Kucherenko29-May-03 23:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.