Click here to Skip to main content
15,923,164 members
Home / Discussions / C#
   

C#

 
GeneralByte Arrays Pin
MrEyes3-Oct-03 0:49
MrEyes3-Oct-03 0:49 
GeneralRe: Byte Arrays Pin
Mattias Olgerfelt3-Oct-03 1:04
Mattias Olgerfelt3-Oct-03 1:04 
GeneralRe: Byte Arrays Pin
MrEyes3-Oct-03 2:24
MrEyes3-Oct-03 2:24 
GeneralRe: Byte Arrays Pin
Daniel Turini3-Oct-03 5:45
Daniel Turini3-Oct-03 5:45 
GeneralAxBrowser/mshtml annoyances Pin
mephist2-Oct-03 16:07
mephist2-Oct-03 16:07 
GeneralCreating a virtual drive Pin
jij@esenet.dk2-Oct-03 10:32
jij@esenet.dk2-Oct-03 10:32 
GeneralRe: Creating a virtual drive Pin
Blake Coverett2-Oct-03 20:18
Blake Coverett2-Oct-03 20:18 
GeneralRe: Creating a virtual drive Pin
James Simpson6-Oct-03 1:01
James Simpson6-Oct-03 1:01 
GeneralRe: Creating a virtual drive Pin
jij@esenet.dk7-Oct-03 7:04
jij@esenet.dk7-Oct-03 7:04 
GeneralRe: Creating a virtual drive Pin
jij@esenet.dk7-Oct-03 7:05
jij@esenet.dk7-Oct-03 7:05 
GeneralString question Pin
Mike Ellison2-Oct-03 10:24
Mike Ellison2-Oct-03 10:24 
GeneralRe: String question Pin
Loki2-Oct-03 10:38
Loki2-Oct-03 10:38 
GeneralRe: String question Pin
Nathan Blomquist2-Oct-03 10:41
Nathan Blomquist2-Oct-03 10:41 
GeneralRe: String question Pin
Nathan Blomquist2-Oct-03 10:40
Nathan Blomquist2-Oct-03 10:40 
GeneralRe: String question Pin
Daniel Turini2-Oct-03 11:08
Daniel Turini2-Oct-03 11:08 
GeneralRe: String question Pin
Mike Ellison2-Oct-03 11:11
Mike Ellison2-Oct-03 11:11 
GeneralRe: String question Pin
Nick Parker2-Oct-03 13:14
protectorNick Parker2-Oct-03 13:14 
GeneralRe: String question Pin
Mike Ellison2-Oct-03 13:32
Mike Ellison2-Oct-03 13:32 
GeneralCrystal Report Types Difference Pin
Inam2-Oct-03 9:19
Inam2-Oct-03 9:19 
Generalconst v readonly Pin
pseudonym672-Oct-03 9:19
pseudonym672-Oct-03 9:19 
GeneralRe: const v readonly Pin
Blake Coverett2-Oct-03 10:18
Blake Coverett2-Oct-03 10:18 
GeneralRe: const v readonly Pin
pseudonym672-Oct-03 12:05
pseudonym672-Oct-03 12:05 
GeneralRe: const v readonly Pin
leppie2-Oct-03 12:48
leppie2-Oct-03 12:48 
GeneralRe: const v readonly Pin
Daniel Turini3-Oct-03 10:34
Daniel Turini3-Oct-03 10:34 
GeneralRe: const v readonly Pin
James T. Johnson3-Oct-03 20:20
James T. Johnson3-Oct-03 20:20 
Building on what leppie and Daniel have said:

You cannot use const in conjunction with your own data types* because they need to be complete at compile time. You can however use readonly with your own data types.

Another scenario is instances where something should be treated as a constant but can't because the constant can change depending on certain behavior. For instance, a class which will perform currency conversion; depending on the two currencies being converted the factor will differ. You can of course expose this factor as a read-only property, but there is nothing to stop your code from changing that value once an instance has been created. If you make the factor readonly though the compiler will ensure you don't change the factor after creating an instance of the class.

Bad example, I know, but just one possibility Smile | :)

James

"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN

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.