I have a custom class Customer and inside another class a method that returns a list based on a LiteCollection from LiteDB typized using the Customer class in the signature. What I wanted to know is if it’s possible creating a method that dynamically chooses which class uses a type, meaning if I can pass as a parameter the class type of the LiteCollection to return when I call the method.
The code is as follows:
public static LiteCollection<Customer> GetCustomers()
{
var collection = ConnectToDB().GetCollection<Customer>("customers");
return collection;
}