Using the below code I see the result as
cardetails = "<ul>" + car.model.Product.Replace("•", "<li>").Replace("\n", "</li>") + "</li></ul>";
Strng 1: "Product":"• Hatchback\n• Hyundai"
- Hatchback
- Hyundai
In the same string I have added Sedan as new type now the complete string is "Product":"• Hatchback\n• Sedan\n• Hyundai" here I need to skip Hatchback and retrieve only Sedan in First list item using conditional operator
- Sedan
- Hyundai
cardetails = carType == CarTypes.Hatchback.ToString()
? "<ul>" + car.model.Product.Replace("•", "<li>").Replace("\n", "</li>") + "</li></ul>"
: "How to add logic here to retrieve Sedan in first <li> and skip hatchback";
How can I achieve this