0
public string Encoding { get; set; } = "Text";


public string Category { get; set; } = "Free"; 

I have an error of token, '='.. What should I do?

Error : Invalid token '=' in class, struct, or interface member declaration

Seth Hong
  • 23
  • 1
  • 4

1 Answers1

0

It seems your compiler does not support that approach. try assigning values in a constructor as shared below.

public string Encoding { get; set; }
public string Category { get; set; } 

public NAMEOFClASS()
{
    this.Encoding="Text";
    this.Category="Free"

}
maccettura
  • 10,514
  • 3
  • 28
  • 35
Abdul Qayyum
  • 1,024
  • 7
  • 15