dimanche 22 septembre 2019

C# Create Class by Concatenating String

public class Customer
{
    public int ProductId { get; set;},
    public string ProductName { get; set;},
    public string ProductDescription { get; set;},
    public float SalesAmount { get; set;}
}

public class Tracker<T>
{
    [Required, ValidateObject]
    public T Body { get; set; }
    public Date date { get; set; }
    public string GUID{ get; set; }
}

Is there a way to create a class, automatically by periods or concatenating string, which will auto compile in Visual Studio

public class CustomerTracker : Tracker<Customer>
{
}

So instead of creating 100s of class as above, I can take any class and it will generate this class automatically. Does any C# Library function permit this?

so Customer.Tracker = public class CustomerTracker : Tracker<Customer>
Customer.ListTracker = public class CustomerTracker : Tracker<IEnumerable<Customer>>

or Food.Tracker = public class FoodTracker : Tracker<Food>





Aucun commentaire:

Enregistrer un commentaire