Ok, I'm probably just having an epic fail here, but my mind wants to say this should work.
Assume DataProtect.DecryptData takes an encrypted string as input and a decrypted string as output. Assume deserializeXML makes the appropriate object and returns it from the newly decrypted string.
So. Why wouldn't this work?
class ArrivedDetails
{
///...
internal ArrivedDetails(string encrypted)
{
this = DataProtect.deserializeXML(DataProtect.DecryptData(encrypted));
}
///...
Gives me an error of
Cannot assign to '<this>' because it's read only
More specifically,, how can I get this working? I essentially want to decrypt an XML serialized version of the object and then deserialize it within the constructor.
I'm open to "you can't" (with an explanation) as I can put it elsewhere and just assign values, but my mind says something like this should be possible.