prasanna p

prasanna p

  • 1.3k
  • 470
  • 103.8k

how to initialise the class property

Mar 8 2022 10:32 AM

Hi Friends,

I have json string like this;

"styles": [  {  "class": "light","hover": { "fill": "#f4f4f4" },"active": { "fill": "#fff" }}]

I am trying to create a class like this

Public class Styles
{
    public string class {get;set;}  //getting error in this line because class name
    public string hover{get;set;}
    public string active{get;set;}
}

I need to assign this to the list

Public List<Styles> styles{get ; set ;}

how to resolve the issue I am getting?

when I am trying to add static json string to the list getting \ in the json string.


Answers (4)