I have 3 properties in my classes which look like following:
public class MyClass
{
public string property1 {get;set;}
public string property2 {get;set;}
public string property3 {get;set;}
}
And I'm trying to switch between these 3 properties when I make an API call...
When I make an API call with any of these properties which is send as parameter towards my server, the server returns a flag "TotalResults". Now what I'd like to do here is to stop making API calls as soon as the server returns TotalResults > 0 (meaning there is at least 1 result returned by server).
So I was thinking I could try this with switch case statement. I'd lik to use the switch case statement like following:
The first case where server returns totalresults>0 i'd like to get out of the switch statement and proceed on with code...
Sample code:
switch (myProperties)
{
case "":
//Do Something
break;
case "":
//Do Something
break;
case "":
//Do Something
break;
default:
//Do the Default
break;
}
So the first case which returns at least 1 result is the one that will be shown in view...
Can someone help me out ?
P.S. I understand I can switch 1 property with different values , but not 3 different properties with switch-case statement?