Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# switch by type of object

switch (myTransport)
{
  case Car car:
    car.Drive();    
    break;
    
  case Plane plane:
    plane.Fly();
    break;
    
  default:
    break;
}
 
PREVIOUS NEXT
Tagged: #switch #type #object
ADD COMMENT
Topic
Name
1+9 =