Click here to Skip to main content
15,912,507 members
Home / Discussions / C#
   

C#

 
GeneralRe: Regex problem Pin
Yaakov Davis23-Dec-04 7:56
Yaakov Davis23-Dec-04 7:56 
GeneralRe: Regex problem Pin
TyronX23-Dec-04 8:09
TyronX23-Dec-04 8:09 
GeneralRe: Regex problem Pin
leppie23-Dec-04 8:10
leppie23-Dec-04 8:10 
GeneralRe: Regex problem Pin
Yaakov Davis23-Dec-04 8:50
Yaakov Davis23-Dec-04 8:50 
GeneralQuestion about efficiency - Hashtable key types Pin
Tristan Rhodes23-Dec-04 6:28
Tristan Rhodes23-Dec-04 6:28 
GeneralRe: Question about efficiency - Hashtable key types Pin
leppie23-Dec-04 7:42
leppie23-Dec-04 7:42 
GeneralRe: Question about efficiency - Hashtable key types Pin
Tristan Rhodes23-Dec-04 9:57
Tristan Rhodes23-Dec-04 9:57 
GeneralRe: Question about efficiency - Hashtable key types Pin
Matt Gerrans23-Dec-04 11:47
Matt Gerrans23-Dec-04 11:47 
Is this for an embedded system? Otherwise quibbling about the overhead for a few hundred objects seems pretty silly.

Anyway, since you didn't say how long the "short string" is, there's no way to guess.

As far as the value type stuff goes, there can be many references to one string. In fact, many identical string literals in your code will all result in the same string in a "constant pool" that is shared (that is, all the places where it is used in your code will instead have a reference to that one constant string instance).

> Now, if 100 objects have this string key, it will be 100x the string value.
No, that's not correct. Of course, there is an exception and it depends on how the references are created. If you create a hundred of these:
class MemHawg
{
   string name;
   public MemHawg( string name )
   {
       this.name = new string( name );
   }
}

Then it will take more memory than this would:
class MemMiser
{
   string name;
   public MemMiser( string name )
   {
       this.name = name;
   }
}

The first one makes a (somewhat useless) copy of the the string passed in, while the second one just has a reference to the one string. So in the second case, you'll have 100 objects that all refer to the same one string.

Of course, the latter implementation makes more sense, since there isn't much sense in duplicating immutable objects.

Matt Gerrans
Questionhow to get mirror printing using c# Pin
bigmega23-Dec-04 5:32
bigmega23-Dec-04 5:32 
AnswerRe: how to get mirror printing using c# Pin
Heath Stewart23-Dec-04 8:16
protectorHeath Stewart23-Dec-04 8:16 
GeneralWindows Installer Problem Pin
Asad Hussain23-Dec-04 5:13
Asad Hussain23-Dec-04 5:13 
GeneralRe: Windows Installer Problem Pin
Heath Stewart23-Dec-04 5:19
protectorHeath Stewart23-Dec-04 5:19 
GeneralRe: Windows Installer Problem Pin
leppie23-Dec-04 7:49
leppie23-Dec-04 7:49 
GeneralRe: Windows Installer Problem Pin
Heath Stewart23-Dec-04 7:54
protectorHeath Stewart23-Dec-04 7:54 
Generalfatal error CS0013: Unexpected error writing metadata to file Pin
Divick23-Dec-04 4:34
Divick23-Dec-04 4:34 
GeneralRe: fatal error CS0013: Unexpected error writing metadata to file Pin
Heath Stewart23-Dec-04 6:07
protectorHeath Stewart23-Dec-04 6:07 
GeneralRe: fatal error CS0013: Unexpected error writing metadata to file Pin
Divick23-Dec-04 19:56
Divick23-Dec-04 19:56 
GeneralRe: fatal error CS0013: Unexpected error writing metadata to file Pin
Heath Stewart23-Dec-04 20:01
protectorHeath Stewart23-Dec-04 20:01 
GeneralRe: fatal error CS0013: Unexpected error writing metadata to file Pin
Divick24-Dec-04 0:52
Divick24-Dec-04 0:52 
GeneralRe: fatal error CS0013: Unexpected error writing metadata to file Pin
Heath Stewart27-Dec-04 10:02
protectorHeath Stewart27-Dec-04 10:02 
GeneralUsing separate class to handle events of user controls Pin
jomargon23-Dec-04 3:44
jomargon23-Dec-04 3:44 
GeneralRe: Using separate class to handle events of user controls Pin
Heath Stewart23-Dec-04 6:03
protectorHeath Stewart23-Dec-04 6:03 
GeneralRe: Using separate class to handle events of user controls Pin
jomargon24-Dec-04 15:06
jomargon24-Dec-04 15:06 
GeneralRe: Using separate class to handle events of user controls Pin
Heath Stewart27-Dec-04 10:21
protectorHeath Stewart27-Dec-04 10:21 
GeneralAsa Client Pin
sreejith ss nair23-Dec-04 3:34
sreejith ss nair23-Dec-04 3:34 

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.