Click here to Skip to main content
15,886,634 members
Home / Discussions / C#
   

C#

 
GeneralRe: question about override and accessing base class methods Pin
Jon Rista26-Oct-02 10:27
Jon Rista26-Oct-02 10:27 
GeneralCollection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 0:38
sitebuilderPaul Watson23-Oct-02 0:38 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Riley23-Oct-02 0:52
Paul Riley23-Oct-02 0:52 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 1:19
sitebuilderPaul Watson23-Oct-02 1:19 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Riley23-Oct-02 1:26
Paul Riley23-Oct-02 1:26 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Riley23-Oct-02 1:32
Paul Riley23-Oct-02 1:32 
GeneralRe: Collection within a Collection and "loading" advice Pin
James T. Johnson23-Oct-02 0:53
James T. Johnson23-Oct-02 0:53 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 1:13
sitebuilderPaul Watson23-Oct-02 1:13 
James T. Johnson wrote:
What you can do to help prevent that is make each object's collection a property

And with those words you made me a happy man! Big Grin | :-D

That is what I have done:
public class StockCollection
    {
        /// <summary>
        /// All StockItems assigned to this collection
        /// </summary>
        public StockItems StockItems
        {
            get {return new StockItems(this);}
        }...


So in essence that return new StockItems(this) bit is only actually "run" when I use that property of the class instance, right? e.g.:
StockCollections stockcollectionsTest = new StockCollections();
            foreach (StockCollection stockcollectionCurrent in stockcollectionsTest)
            {
                Response.Write("Collection Title: " + stockcollectionCurrent.Title + "<br />");
                // At this point property StockItems has not been "run" and therefore no sub-items populated, right?
                foreach(StockItem stockitemCurrent in stockcollectionCurrent.StockItems)
                {
                    // But now it has been populated because of the stockcollectionCurrent.StockItems just above, right?
                    Response.Write("StockItem Title: " + stockitemCurrent.Title + "<br />");
                }
            }


I guess I should have actually stated in my question that the sub-collections are exposed as get properties of the items (it is often hard to figure out at which level to pitch a question. To high and people who may have the answer you are looking for ignore it, too low and you have to go through fifty sub questions to get to the heart f the matter.)

Properties rock overall IMO Smile | :)

Thanks James.

Paul Watson
Bluegrass
Cape Town, South Africa

GeneralRe: Collection within a Collection and "loading" advice Pin
James T. Johnson23-Oct-02 1:20
James T. Johnson23-Oct-02 1:20 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 1:59
sitebuilderPaul Watson23-Oct-02 1:59 
GeneralRe: Collection within a Collection and "loading" advice Pin
James T. Johnson23-Oct-02 2:28
James T. Johnson23-Oct-02 2:28 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 3:12
sitebuilderPaul Watson23-Oct-02 3:12 
GeneralRe: Collection within a Collection and "loading" advice Pin
James T. Johnson23-Oct-02 3:26
James T. Johnson23-Oct-02 3:26 
GeneralRe: Collection within a Collection and "loading" advice Pin
Daniel Turini23-Oct-02 1:23
Daniel Turini23-Oct-02 1:23 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 2:05
sitebuilderPaul Watson23-Oct-02 2:05 
GeneralRe: Collection within a Collection and "loading" advice Pin
Daniel Turini23-Oct-02 2:22
Daniel Turini23-Oct-02 2:22 
GeneralRe: Collection within a Collection and "loading" advice Pin
Jon Rista23-Oct-02 18:33
Jon Rista23-Oct-02 18:33 
GeneralRe: Collection within a Collection and "loading" advice Pin
Paul Watson23-Oct-02 21:19
sitebuilderPaul Watson23-Oct-02 21:19 
GeneralRe: Collection within a Collection and "loading" advice Pin
Jon Rista27-Oct-02 17:48
Jon Rista27-Oct-02 17:48 
Questionthread.Abort() doesn't work????? Pin
fftongzhi22-Oct-02 15:23
fftongzhi22-Oct-02 15:23 
AnswerRe: thread.Abort() doesn't work????? Pin
Paul Riley23-Oct-02 0:17
Paul Riley23-Oct-02 0:17 
GeneralRe: thread.Abort() doesn't work????? Pin
James T. Johnson23-Oct-02 0:58
James T. Johnson23-Oct-02 0:58 
GeneralRe: thread.Abort() doesn't work????? Pin
fftongzhi23-Oct-02 16:04
fftongzhi23-Oct-02 16:04 
GeneralRe: thread.Abort() doesn't work????? Pin
James T. Johnson23-Oct-02 16:57
James T. Johnson23-Oct-02 16:57 
GeneralRe: thread.Abort() doesn't work????? Pin
fftongzhi23-Oct-02 18:51
fftongzhi23-Oct-02 18:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.