December 2018
Beginner to intermediate
668 pages
15h 30m
English
In .NET, strings are immutable objects. Two strings refer to the same memory on the heap until the string value is changed. If any of the string is changed, a new string is created on the heap and is allocated a new memory space. Immutable objects are generally thread safe and eliminate the race conditions between multiple threads. Any change in the string value creates and allocates a new object in memory and avoids producing conflicting scenarios with multiple threads.
For example, let's initialize the string and assign the Hello World value to the a string variable:
String a = "Hello World";
Now, let's assign the a string variable to another variable, b:
String b = a;
Both a and b point to the same value on the ...
Read now
Unlock full access