Joe Go

Joe Go

  • NA
  • 1
  • 1.2k

String vs char[]

Mar 23 2013 5:53 PM
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)