C#C
C#3y ago
5 replies
SWEETPONY

✅ How to get class structure with types?

I have following class:
public class ReportTemplatesListArguments
{
    [JsonProperty( PropertyName = "pagination" )]
    public Pagination Pagination { get; set; }
}

public class Pagination
{
    public Pagination()
    {
    }

    public Pagination( int pageSize )
    {
        PageSize = pageSize;
    }

    public Pagination(
        int pageSize,
        int pageIndex )
    {
        PageSize = pageSize;
        PageIndex = pageIndex;
    }

    [JsonProperty( PropertyName = "page_index" )]
    public int PageIndex { get; set; }

    [JsonProperty( PropertyName = "page_size" )]
    [JsonRequired]
    public int PageSize { get; set; }

    [JsonIgnore]
    public int Skip =>
        PageSize * PageIndex;

    [JsonIgnore]
    public int Limit =>
        PageSize;
}


I'd like to get following object:
   Pagination
     PageIndex, Type = int
     PageSize, Type = int


how to do it?
Was this page helpful?