What?s the difference between System.String and
System.StringBuilder classes?
Answers were Sorted based on User's Feedback
Answer / sundarchum
Both the String and StringBuilder class are used to store
strings. One exception is when we change the value in the
string it will create a new String object is creating in
memory and assign the new value.
eg: String name = "Sundar";
A new name object is creating in memory and the
value "Sundar Rahul" is assinging to the newly created
space.
eg: String name = "Sundar Rahul";
But StringBuilder class occupies the same space even if you
change the value.
StringBuilder gives you better performance than String
class when you perform string manipulations like string
concatenation.
You can use StringBuilder's Append() method to use
concatenation and for String use "+".
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / guest
System.String is immutable, System.StringBuilder was
designed with the purpose of having a mutable string where a
variety of operations can be performed
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / akash
Both the String and StringBuilder class are used to store
strings. One exception is when we change the value in the
string it will create a new String object is creating in
memory and assign the new value.
eg: String name = "Sundar";
A new name object is creating in memory and the
value "Sundar Rahul" is assinging to the newly created
space.
eg: String name = "Sundar Rahul";
But StringBuilder class occupies the same space even if you
change the value.
StringBuilder gives you better performance than String
class when you perform string manipulations like string
concatenation.
You can use StringBuilder's Append() method to use
concatenation and for String use "+".
Is This Answer Correct ? | 0 Yes | 0 No |
How do you comment out code in c#?
How long has c# been around?
Why to use “using” in c#?
Is nullable type c#?
What is the best method to fill the GridView. using SqlDataReader or Dataset and why
Explain constructor.
What is extension method in c# and how to use them?
What is desktop example?
Does c# support multiple inheritance (mi)?
What do you mean by winforms in c#?
Explain publishers and subscribers in events.
how to Create a datagridview control with check box column with 8rows in it, the maximum number of check boxes checked should be 3, when user checks the 4th corresponding message should be displayed and check box should be checked. User can uncheck the checked boxes Note: read-only property should not be used