Hi Mortos,
There is not a hardwired relationship between both classes, you can create
either one independently from the other like this:
BigClass.MiniClass instance = new BigClass.MiniClass()
BigClass instance = new BigClass()
Creating a BigClass instance does not create a MiniClass. I think that there
are two big differences between declaring both class at the same level or
one inside other:
1- Naming polution control, you decrease the number of types on the
namespace, as you will reference the inner class as ExternalClass.InnerClass
.. This also give an idea that the InnerClass is related to the OuterClass.
2- The inner class has access to the private members of the outer class, so
you can do this :
public class BigClass
{
private int ID_BigClass = -99;
public class MiniClass
{
public void MiniFunc(BigClass b)
{
int intBigClassID = b.ID_BigClass;
}
}
}
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Mortos" <th*****@spammer.co.uk> wrote in message
news:_h*****************@news-binary.blueyonder.co.uk...
I need some quick advice.
I just need to reference a containing class from the nested class. I'm
familiar with Java but C# is proving tricky.
public BigClass {
public int ID_BigClass = -99;
public MiniClass{
public void MiniFunc(){
//How do i get ID_BigClass?
int intBigClassID = {Reference to instance og Big Class}
}
}
}
Thanks
--
I AM MORTOS!!!! (Switch spammer with blueyonder)