Hello
I'd like to know how I can implement something like the enums from Swift into C# MyBPCreditcard
My use case: in the code you can load List<Something>
from multiple different sources. From all sources, I receive the same list of Somethings
I can either retrieve it from API1, but I'd have to pass 1parameters to it. I can also load it from API2 but I'd have to pass 2 parameters to it. I can load it from my local database.
so essentially my function looks like
List<Something> LoadSomethings(Query query) {
switch query {
// implement cases
}
// do something with results afterwards
return results
}
in Swift you can easily do
enum Query {
case Api1(query1: Int)
case Api2(query1: Int, query2: String)
case Locally
}
What would be the equivalent solution in C# 9?