Try this:
public class Test<T> where T : Customer
where T : Customer
makes sure you can only use the type
Customer
or types derived from
Customer
.
Then, change this line in the
Main
method:
Test<Customer> T1 = new Test<Customer>(obj);
Change
object
into
Customer
, otherwise you will get a compiler error.
Now, you will be able to access the properties from the
Customer
class from your generic class.