I have the following code (simplified), a structure and a class.
public struct pBook
{
private int testID;
public string request;
public string response;
public Int32 status;
public int test_id
{
get
{
return testID;
}
set
{
testID = value;
}
}
};
public class TestClass
{
public static void Main(string[] args)
{
pBook Book1;
pBook Book2;
Book1.request = "a";
Book2.response = "b";
Book2.status = 201;
Book2.test_id = 0; //this doesn't work, why?
}
}
At the statement
Book2.test_id = 0;
I get the error
use of unassigned local variable 'Book2'
Any ideas how to correct?