Nested classes (C#)

liunx

Guest
Dear All,


I'm presently working on a project that will log events for nurses that go out in the community. Each event stores the usual time and date start and ends, details about the type of event etc...

One of the properties is a parent record which is used to track nested events.

I've created the basis of the class that will handle the basic data gets/sets and import from SQL Server. The thing I'm trying to do now is provide a method for the class that will build an array of child events for the current one. Is it possible, therefore, to define an array of the current class as the return?

(Please let me know if I'm confusing the hell out of you!).


Paul.Yes it is possible but would be advisable to examine the details of such..

Personally I would create a data access class that returns an array of another type.

On data creation event on the master datagrid you can populate teh data.

Otherwise I would stick with the DataSet and use the DataRelation Class to populate the child event datagrid.Thanks, Afterburn.

It's not actually a data grid I'm populating. Instead, I want to dimension an array (or container of multiple instances) of the class that's doing the work within that class, and return the results from a method. I'm just wondering whether this will cause any problems such as circular references etc.

Paul.Circular references are not against the OPP design. Diamond shaped references are. Thats why .net only allows inheritance of one class the rest are interfaces that you must implement.Hmm... This is going a bit beyond my boundaries, here. I think I'm going to have to look into this a bit more.

For now, I'll just implement a simplified approach as you recommend.

Thanks for your help, Afterburner.
 
Back
Top