The following code suggests I cannot use implicit properties with a struct:
public struct LimitfailureRecord
{
public LimitfailureRecord(string sampleCode)
{
SampleCode = sampleCode;
}
public string SampleCode {get; set;}
{
}
}
It fails to compile, with the error message
"Backing field for automatically implemented property 'blahblah.LimitfailureRecord.SampleCode' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer."
If I change the struct to a class it's fine. What do I need to do to make this work as a struct? I'd rather not go to the lengths of backing fields (this is a heavily stripped down version of the real code) if I can avoid it.