Please refer to the below-given code snippet
foreach (var invoiceDescription in qbInvoiceLineArray)
{
Line lineDescription = new Line();
lineDescription.Description = Convert.ToString((string)invoiceDescription.SelectToken(QBConfig.InvoiceDescription));
invoice.Line.Add(lineDescription);
}
public class QbInvoiceViewModel
{
public decimal Balance { get; set; }
public List<LinkedTxn> LinkedTxn { get; set; }
public DateTime DueDate { get; set; }
public DateTime TxnDate { get; set; }
public Decimal TotalAmt { get; set; }
public List<Line> Line { get; set; }
}
public class Line
{
public string Description { get; set; }
public LineDetailTypeEnum DetailType { get; set; }
}
public enum LineDetailTypeEnum
{
SalesItemLineDetail
}
This line of code
lineDescription.Description = Convert.ToString((string)invoiceDescription.SelectToken(QBConfig.InvoiceDescription));
can be used to convert string to string in c#. This type of code can be used to convert string to int also in c#. But how this type of code can be used to convert string to enum?