Strings are Immutable | C# Interview Questions | Csharp Interview Questions

preview_player
Показать описание
strings are immutable
See our other Step by Step video series below :-
---------------------------------------------------------------------------------
For more details :-
📱 Mob. No. : +91-9967590707 / +91 7700975156 / +91-22-49786776

Share, Support, Subscribe and Connect us on!!!

#StringsareImmutableInC# #C#InterviewQuestionandAnswers #CSharpInterviewQuestionsforFreshers #CsharpInterviewQuestions #C#InterviewQuestionsforExperiencedProfecsnals #InterviewQuestionsforC# #CSharpStrings
Рекомендации по теме
Комментарии
Автор

1. String is reference type.
2. Internally it uses Array to save value.
3. Array have fixed size.
4. If we are going to store dynamic value in string every time, that array will not store the same because of size.
5. So every time fresh objects are created.
6. Thats why string are immutable.

pravinkshirsagar
Автор

Dear sir thank you for efforts. String are immutable because strings are reference type and
1.multiple string variables with the same value then it will avoid allocating memory for the same string value multiple times.
2. immutable strings eliminate race conditions in multi-threaded applications

Girishur
Автор

Dear Sir,
Thank you so much for giving such a clear understanding of this concept. I was aware of string is immutable, but how to prove it, I got this from this video.

pratikgirme
Автор

Nice video. I especially like how you used the diagnostic window to show all the string objects being garbage collected.

jayjeckel
Автор

The reason for string being immutable object is that in case of assignment of one string variable to another string, any change in the previous string would lead to unwanted changes in the copied string just like other reference types

maheshpatkar
Автор

Why this behavior of string are there, i mean immutable ?

miscVideo
Автор

Everyone it create new object.
Because it is reference type.

ParidhiStyle
Автор

What is the best way to avoid immutable functionality of string?

omkargorde