Answer the question
In order to leave comments, you need to log in
It is impossible to change the data in the structure directly?
Company is a structure. Owner and CompanyName are properties.
Error: Failed to change return value for '*.Company' because it is not a variable
Question: is it forbidden to change the data in the structure, on a straight line?
Answer the question
In order to leave comments, you need to log in
I assume that the Company field in the Im.Work object is also described as a property:
public Company Company{ get; set; }
In this case, when you write Im.Work.Company.CompanyName="Name", the get method for Company is called, returns a copy of the structure (because it cannot return a reference), and then you try in this copy without putting it anywhere , change one of the fields. The original will definitely not change from this, and, apparently, the compiler does not allow you to perform a deliberately meaningless action (change the object that will now be destroyed).
public struct Company
{
public string CompanyName { get; set; }
public Build Build { get; set; }
public Human Owner { get; set; }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question