I have a nested class, let’s call it class1 and it has class2 inside it; VB.Net eg:
Public Class class1
Public Class class2
Public Sub New()
end sub
end class
Public Sub New()
'**1) How can I define X number of Class2 objects[let's call it: Node(x) array]** with NEW() subroutine called?
' this raises error: dim cls2(n) as new class2
end sub
Public ReadOnly Property Count As Integer
Get
' **2) How can I return actual number of Node() array?**
End Get
End Property
end class
Outside my class in main project I define cls1 object:
dim cls1 as new class1
Now an array of class2 is created inside cls1.
3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?
I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don’t have the code now.
Please write the answer in VB.net or if you can’t C#. thanks a lot and saluets to you.
Create a list:
Then your property would return:
To expose the list of items, I would favor a readonly IEnumerable property: