1
Answer

String vs char[]

Joe Go

Joe Go

11y
914
1
I'm wondering after having looked at my assemblies with ildasm what would be the preferred method to use string constant values?

1) This creates a user string in the assembly:
var x = "bogus";

2) while this doesn't:
var x = new string(new char[] { 'b', 'o', 'g', 'u', 's' });


Say, one is going to use x for building XML-structures or other concatenating task, is there any advantage to using method 1 or 2 or is just 'same-same-but-different'?
Answers (1)