Horje
c# switch expression pattern matching Code Example
c# switch expression pattern matching
string startsWith = "somestring:";

 switch (startsWith)
 {
	 // Using the 'when' keyword you can convert your case to a bool like
     // expression like so:
     case string when startsWith.StartsWith("somestring:"):
         Console.WriteLine("hit");
         break;

   case string when startsWith.StartsWith("someotherstring:"):
		Console.WriteLine("hit 1");
		break; 
}

// Output: hit




Csharp

Related
get sprite name from gameobject Code Example get sprite name from gameobject Code Example
2d unity point at Code Example 2d unity point at Code Example
c# mock ref parameter Code Example c# mock ref parameter Code Example
C# one line method Code Example C# one line method Code Example
Get enum value from string or int Code Example Get enum value from string or int Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11