public List<string> MembershipIds
{
get;
set;
} = new List<string>();
I got Invalid token
"=" in class, struct or interface member declaration.
This is C# 6 feature. How to convert it to C# 5?
Convert celsius to fahrenheit 1 Celsius is equal to 33.8 Fahrenheit.
Quick Celsius (°C) / Fahrenheit (°F) Conversion:°C.
If you find yourself needing to quickly convert Celsius to Fahrenheit, here is a simple trick you can use: multiply the temperature in degrees Celsius by 2, and then add 30 to get the (estimated) temperature in degrees Fahrenheit.
Answer: 50° Celsius is equal to 122° Fahrenheit.
There is no easy way to do it while leaving the auto-property in place.
If you do not require an auto property, convert the code to using a private variable and a non-automatic property:
private List<string> membershipIds = new List<string>();
public List<string> MembershipIds {
get { return membershipIds; }
set { membershipIds = value; }
}
If you do require the auto-property, you need to make the assignment in the constructor:
public List<string> MembershipIds { get;set; }
...
// This constructor will do the assignment.
// If you do not plan to publish no-argument constructor,
// it's OK to make it private.
public MyClass() {
MembershipIds = new List<string>();
}
// All other constructors will call the no-arg constructor
public MyClass(int arg) : this() {// Call the no-arg constructor
.. // do other things
}
public MyClass(string arg) : this() {// Call the no-arg constructor
.. // do other things
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With