Hi ramco1917,
Refer below sample code.
Class Property
C#
public class ItemList
{
public int ItemNo { get; set; }
public string SlNo { get; set; }
public string IsServc { get; set; }
public string PrdDesc { get; set; }
public string HsnCd { get; set; }
public int Qty { get; set; }
public int FreeQty { get; set; }
public string Unit { get; set; }
public int UnitPrice { get; set; }
public int TotAmt { get; set; }
public int Discount { get; set; }
public int PreTaxVal { get; set; }
public int OthChrg { get; set; }
public int TotItemVal { get; set; }
public int AssAmt { get; set; }
public int GstRt { get; set; }
public int IgstAmt { get; set; }
public int CgstAmt { get; set; }
public int SgstAmt { get; set; }
public int CesRt { get; set; }
public int CesAmt { get; set; }
public int CesNonAdvlAmt { get; set; }
public int StateCesRt { get; set; }
public int StateCesAmt { get; set; }
public int StateCesNonAdvlAmt { get; set; }
}
public class ValDtls
{
public int AssVal { get; set; }
public int CgstVal { get; set; }
public int SgstVal { get; set; }
public int IgstVal { get; set; }
public int CesVal { get; set; }
public int StCesVal { get; set; }
public int Discount { get; set; }
public int OthChrg { get; set; }
public int RndOffAmt { get; set; }
public int TotInvVal { get; set; }
}
public class Root
{
public List<ItemList> ItemList { get; set; }
public ValDtls ValDtls { get; set; }
}
VB.NET
Public Class ItemList
Public Property ItemNo As Integer
Public Property SlNo As String
Public Property IsServc As String
Public Property PrdDesc As String
Public Property HsnCd As String
Public Property Qty As Integer
Public Property FreeQty As Integer
Public Property Unit As String
Public Property UnitPrice As Integer
Public Property TotAmt As Integer
Public Property Discount As Integer
Public Property PreTaxVal As Integer
Public Property OthChrg As Integer
Public Property TotItemVal As Integer
Public Property AssAmt As Integer
Public Property GstRt As Integer
Public Property IgstAmt As Integer
Public Property CgstAmt As Integer
Public Property SgstAmt As Integer
Public Property CesRt As Integer
Public Property CesAmt As Integer
Public Property CesNonAdvlAmt As Integer
Public Property StateCesRt As Integer
Public Property StateCesAmt As Integer
Public Property StateCesNonAdvlAmt As Integer
End Class
Public Class ValDtls
Public Property AssVal As Integer
Public Property CgstVal As Integer
Public Property SgstVal As Integer
Public Property IgstVal As Integer
Public Property CesVal As Integer
Public Property StCesVal As Integer
Public Property Discount As Integer
Public Property OthChrg As Integer
Public Property RndOffAmt As Integer
Public Property TotInvVal As Integer
End Class
Public Class Root
Public Property ItemList As List(Of ItemList)
Public Property ValDtls As ValDtls
End Class
Code
C#
Root root = new Root();
ValDtls valDtls = new ValDtls
{
AssVal = 5000,
CgstVal = 0,
SgstVal = 0,
IgstVal = 900,
CesVal = 0,
StCesVal = 0,
Discount = 0,
OthChrg = 0,
RndOffAmt = 0,
TotInvVal = 5900
};
List<ItemList> itemList = new List<ItemList>
{
new ItemList
{
ItemNo = 0,
SlNo = "1",
IsServc = "N",
PrdDesc = "Computer Hardware - Keyboard and Mouse",
HsnCd = "320504",
Qty = 25,
FreeQty = 0,
Unit = "PCS",
UnitPrice = 200,
TotAmt = 5000,
Discount = 0,
PreTaxVal = 0,
AssAmt = 5000,
GstRt = 18,
IgstAmt = 900,
CgstAmt = 0,
SgstAmt = 0,
CesRt = 0,
CesAmt = 0,
CesNonAdvlAmt = 0,
StateCesRt = 0,
StateCesAmt = 0,
StateCesNonAdvlAmt = 0,
OthChrg = 0,
TotItemVal = 5900
}
};
root.ValDtls = valDtls;
root.ItemList = itemList;
VB.NET
Private Sub SurroundingSub()
Dim root As Root = New Root()
Dim valDtls As ValDtls = New ValDtls With {
.AssVal = 5000,
.CgstVal = 0,
.SgstVal = 0,
.IgstVal = 900,
.CesVal = 0,
.StCesVal = 0,
.Discount = 0,
.OthChrg = 0,
.RndOffAmt = 0,
.TotInvVal = 5900
}
Dim itemList As List(Of ItemList) = New List(Of ItemList) From {
New ItemList With {
.ItemNo = 0,
.SlNo = "1",
.IsServc = "N",
.PrdDesc = "Computer Hardware - Keyboard and Mouse",
.HsnCd = "320504",
.Qty = 25,
.FreeQty = 0,
.Unit = "PCS",
.UnitPrice = 200,
.TotAmt = 5000,
.Discount = 0,
.PreTaxVal = 0,
.AssAmt = 5000,
.GstRt = 18,
.IgstAmt = 900,
.CgstAmt = 0,
.SgstAmt = 0,
.CesRt = 0,
.CesAmt = 0,
.CesNonAdvlAmt = 0,
.StateCesRt = 0,
.StateCesAmt = 0,
.StateCesNonAdvlAmt = 0,
.OthChrg = 0,
.TotItemVal = 5900
}
}
root.ValDtls = valDtls
root.ItemList = itemList
End Sub
Screenshot