T in c#

Here is few simple samples of how its works:

<T> as method param

public class Json {
    public static string Convert<T>(List<T> items, int totla_records) {
        Type type = typeof(T);
        return MetaData.Generate(type, totla_records);
    }
}

Usage:

List<SaleCompanyInfo> list = dp.GetList(10);
string response = Json.Convert(list, 10);

<T> as class field:

public class ResponseReader<T> : ResponseBase
{
    public int total;
    public MetaData metaData;
    public List<T> data;

    public ResponseReader(List<T> items, int total_rows)
    {
        this.total = total_rows;
        this.metaData = new MetaData(typeof(T));
        this.data = items;
    }
}

Usage:

List<SaleCompanyInfo> list = dp.GetList(10);
ResponseReader<SaleCompanyInfo> resp = new ResponseReader<SaleCompanyInfo>(list, 10);