Click here to Skip to main content
16,013,642 members
Home / Discussions / C#
   

C#

 
AnswerRe: String.empty v.s. string.null Pin
Pete O'Hanlon19-Jun-08 3:42
mvePete O'Hanlon19-Jun-08 3:42 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 3:58
George_George19-Jun-08 3:58 
GeneralRe: String.empty v.s. string.null Pin
Colin Angus Mackay19-Jun-08 4:02
Colin Angus Mackay19-Jun-08 4:02 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:36
George_George19-Jun-08 22:36 
GeneralRe: String.empty v.s. string.null Pin
leppie19-Jun-08 4:35
leppie19-Jun-08 4:35 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:39
George_George19-Jun-08 22:39 
GeneralRe: String.empty v.s. string.null Pin
Rutvik Dave19-Jun-08 4:35
professionalRutvik Dave19-Jun-08 4:35 
GeneralRe: String.empty v.s. string.null Pin
Colin Angus Mackay19-Jun-08 5:34
Colin Angus Mackay19-Jun-08 5:34 
Rutvik Dave wrote:
If All the variables initialized to
String.Empty
Then They will point to different memory address


Incorrect. Here is what reflector has to say on the subject:
public static readonly string Empty;

That means there is only one representation ever in memory. It is not copied, it is referenced. That means they will ALL point to the same memory address.

Rutvik Dave wrote:
It is not possible that you create two different reference type variables and they have same memory reference, unless you assign one variable to another.


That is correct, but it does not apply to the current situation as you are not creating different objects. You are referencing an existing object.


Rutvik Dave wrote:
remeber that string is immutable. so every time you change the value it will be allocated and initialize with the new value again


Also correct, but does not apply in this question.


GeneralRe: String.empty v.s. string.null Pin
Zoltan Balazs19-Jun-08 5:53
Zoltan Balazs19-Jun-08 5:53 
GeneralRe: String.empty v.s. string.null Pin
leppie19-Jun-08 6:05
leppie19-Jun-08 6:05 
GeneralRe: String.empty v.s. string.null Pin
Zoltan Balazs19-Jun-08 6:14
Zoltan Balazs19-Jun-08 6:14 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:52
George_George19-Jun-08 22:52 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:50
George_George19-Jun-08 22:50 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:49
George_George19-Jun-08 22:49 
GeneralRe: String.empty v.s. string.null Pin
Zoltan Balazs20-Jun-08 1:12
Zoltan Balazs20-Jun-08 1:12 
GeneralRe: String.empty v.s. string.null Pin
George_George20-Jun-08 4:00
George_George20-Jun-08 4:00 
GeneralRe: String.empty v.s. string.null Pin
Rutvik Dave19-Jun-08 9:22
professionalRutvik Dave19-Jun-08 9:22 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:53
George_George19-Jun-08 22:53 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:45
George_George19-Jun-08 22:45 
GeneralRe: String.empty v.s. string.null Pin
Colin Angus Mackay20-Jun-08 7:07
Colin Angus Mackay20-Jun-08 7:07 
GeneralRe: String.empty v.s. string.null Pin
George_George23-Jun-08 23:44
George_George23-Jun-08 23:44 
GeneralRe: String.empty v.s. string.null Pin
Colin Angus Mackay20-Jun-08 7:11
Colin Angus Mackay20-Jun-08 7:11 
GeneralRe: String.empty v.s. string.null Pin
George_George23-Jun-08 23:47
George_George23-Jun-08 23:47 
AnswerRe: String.empty v.s. string.null Pin
User 665819-Jun-08 4:32
User 665819-Jun-08 4:32 
GeneralRe: String.empty v.s. string.null Pin
George_George19-Jun-08 22:55
George_George19-Jun-08 22:55 

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.