C# ?? null coalescing operator
Posted
by anirudha
on Geeks with Blogs
See other posts from Geeks with Blogs
or by anirudha
Published on Sat, 04 Dec 2010 16:16:13 GMT
Indexed on
2010/12/06
16:57 UTC
Read the original article
Hit count: 666
the null coalescing operator is used for set the value when object is null. if object have some value that nothing change and still have their default value they have.
string str = "i am string";
string message = str ?? "it is null";
the message have same value as str variable because str not null. if str is null that message have value “it is null”; as declared in statement.
coalescing operator does not work on nullable operator such as int?
© Geeks with Blogs or respective owner