Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# inline question mark on object

public class A {
  string PropertyOfA { get; set; }
}

A myA = null;
var foo = "bar";
string bar = (a == null ? null : a.PropertyOfA);
// both the same
if (a?.PropertyOfA != foo || bar != foo)
{
    // do something
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Attach Mixer to Audio Source via script 
Csharp :: override indexation C# 
Csharp :: how to get the color of other label when clicking c# 
Csharp :: unity check if gameobject is active 
Csharp :: hello in c# 
Csharp :: c# filter non alphanumeric characters 
Csharp :: Codewars Multiply 
Csharp :: csharp datetime string format 
Csharp :: unity2d click on gameobject 
Csharp :: car controller script unity 
Csharp :: ensuresuccessstatuscode exception 
Csharp :: convert object to xml c# example code 
Csharp :: renaming table name entity framework code first fluent api 
Csharp :: how to do fizzbuzz in c# 
Csharp :: c# start process and wait for exit code 
Csharp :: unity mouse movement 
Csharp :: c# negative index 
Csharp :: traversing an enum c# 
Csharp :: c# keep console open 
Csharp :: c# return list 
Csharp :: c# method summary new line 
Csharp :: ession in class c# 
Csharp :: c# how to use inovke 
Csharp :: c# average of 3 numbers 
Csharp :: c# pick a random item from array 
Csharp :: .net mvc c# alert to client browswer window 
Csharp :: initialize ConsoleLoggerProvider in EF core 
Csharp :: 2d game art 
Csharp :: how to loop over array in c# 
Csharp :: how to deselect a button through code unity 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =