Constructor question, reference problem
Hello
I have two questions.
1. Is it possible to call base constructor in the body of the current constructor?
I want code like this:
class MyClass
{
public MyClass()
{
// some code here
base();
}
}
2. I don't understand this code. I have an object that returns reference to the DataTable it contains. I am wondering how come that in following code t variable remains valid:
void MyClass()
{
DataTable t;
void SomeFunc(){
using ( ObjectWithTable owt = new ObjectWithTable() )
{
t = owt.Table;
}
}
}
The GC will free the owt as soon as it exits the using statement, but I can still access its table over t.
Thanks.