Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

null coalescing operator c#

//the null coalescing operator for c# is ??
int? x = null;
int y = 9;
return x ?? y; 
//Will return the value of x if x is not null else return y
Comment

c# null coalescing operator

static void Sample(string input)
{
    string result = input ?? "default";
    Console.WriteLine($"Result: {result}");
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get current time c# 
Csharp :: linq get a dictionary key and value c# 
Csharp :: unity find object by name recursion 
Csharp :: how to create a list c# 
Csharp :: datetimeoffset to datetime c# 
Csharp :: c# execute shell command 
Csharp :: c# multi assignment 
Csharp :: if file exist rename c# 
Csharp :: c# not 
Csharp :: c# remove word from string 
Csharp :: c# settings file 
Csharp :: or c# 
Csharp :: c# convert string array to int array 
Csharp :: if statement c# 
Csharp :: list to array c# 
Csharp :: .net core partial view with model 
Csharp :: Change Level in Unity 
Csharp :: get sha1 hashcode from c# 
Csharp :: check property type of collection c# 
Csharp :: c# struct 
Csharp :: unity get gameobject from hit 
Csharp :: unity reference textmeshpro 
Csharp :: LINQ query on a DataTable C# 
Csharp :: how to add to a list only items that are not already in the list c# 
Csharp :: what is void onmousedown() 
Csharp :: assembly project name c# .net 
Csharp :: how to store some variables on the device in unity 
Csharp :: C# round number of digits after decimal point 
Csharp :: how to trim path in C# 
Csharp :: C# Switch and case 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =