Handling Unsupported Types
问题 I am creating an array of data: var data = new Data[] { 1, "string", true, //.. }; //In this case, assume that strings and booleans are supported types, but integers are not. When I store the set of data, it runs through a series of if statements to store data: if (data is string) StoreData(data as string); else if (data is boolean) StoreData(data as boolean); //.. Because integers are not supported, I would like my code to handle it appropriately (whether it would be logging, etc.). However,