switch case c# contains
Correct final syntax for [Mr. C]s answer.
With the release of VS2017RC and its C#7 support it works this way:
switch(message)
{
case string a when a.Contains("test2"): return "no";
case string b when b.Contains("test"): return "yes";
}
You should take care of the case ordering as the first match will be picked. That's why "test2" is placed prior to test.
Also in C#:
- convert string to decimal c#
- unity get child
- unity print
- unity rotate around point
- unity set material color
- download and run exe c# 1 button
- get list length c#
- how to reduce garbage collection c#
- reverse a string in c#
- ihttpactionresult to object c#
- c# declare an int list
- open zip file in c#
- sum the digits in c#
- button commandfield commandargument pass textbox
- c# loop through object
- c# download outlook msg file attachment
- how to detected WindowCloseEvent in other window wpf
- convert array object to int[] c#
- c# checksum
- c# find comma in text and remove
- c# access session in class
- c# distinct comparer multiple properties
- c# sql duplicate key exception
- C# Into To Tring Debug.Log