Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
Questionis object part of CollectionBase Pin
Hanzaplast19-Jan-12 5:26
Hanzaplast19-Jan-12 5:26 
hi guys

can i get Collection from object if it is part of it?

code should look something like this

C#
public class SomeCollection : CollectionBase
{
   public void Add(SomeClass sc)
   {
       this.List.Add(sc);
   }
}

class SomeClass
{
   public bool AmIPartOfCollection
   {
       get
       {
          //return false or true 
       }
   }

   public SomeCollection MyCollection
   {
      get
      {
          //if this object is part of SomeCollection return his SomeCollection
      }
   }
}

void Main()
{
    SomeClass temp = new SomeClass();
    //temp.AmIPartOfCollection - want to get false
    //temp.MyCollection - want to get null

    SomeCollection sc = new SomeCollection();
    sc.Add(temp);

    //temp.AmIPartOfCollection - want to get true
    //temp.MyCollection - want to get reference to "sc" object
}

AnswerRe: is object part of CollectionBase Pin
BobJanova19-Jan-12 6:41
BobJanova19-Jan-12 6:41 
AnswerRe: is object part of CollectionBase Pin
Luc Pattyn19-Jan-12 7:24
sitebuilderLuc Pattyn19-Jan-12 7:24 
GeneralRe: is object part of CollectionBase Pin
Dave Kreskowiak19-Jan-12 7:30
mveDave Kreskowiak19-Jan-12 7:30 
GeneralRe: is object part of CollectionBase Pin
Luc Pattyn19-Jan-12 8:01
sitebuilderLuc Pattyn19-Jan-12 8:01 
GeneralRe: is object part of CollectionBase Pin
BillWoodruff19-Jan-12 20:24
professionalBillWoodruff19-Jan-12 20:24 
Questionusing variables in SSIS script task: c# code Pin
bigphish19-Jan-12 1:33
bigphish19-Jan-12 1:33 
GeneralRe: using variables in SSIS script task: c# code Pin
Richard MacCutchan19-Jan-12 22:58
mveRichard MacCutchan19-Jan-12 22:58 
QuestionWSE3 Soap Service generated XML structure modification at runtime. Pin
FrankieG197519-Jan-12 1:08
FrankieG197519-Jan-12 1:08 
AnswerRe: WSE3 Soap Service generated XML structure modification at runtime. Pin
FrankieG197522-Jan-12 20:21
FrankieG197522-Jan-12 20:21 
QuestionHow to handle this Event ? Pin
Paramu197318-Jan-12 23:01
Paramu197318-Jan-12 23:01 
AnswerRe: How to handle this Event ? PinPopular
Eddy Vluggen19-Jan-12 0:31
professionalEddy Vluggen19-Jan-12 0:31 
GeneralRe: How to handle this Event ? Pin
Paramu197320-Jan-12 18:43
Paramu197320-Jan-12 18:43 
GeneralRe: How to handle this Event ? Pin
Eddy Vluggen21-Jan-12 1:40
professionalEddy Vluggen21-Jan-12 1:40 
AnswerRe: How to handle this Event ? PinPopular
BobJanova19-Jan-12 1:01
BobJanova19-Jan-12 1:01 
GeneralRe: How to handle this Event ? Pin
Paramu197320-Jan-12 18:44
Paramu197320-Jan-12 18:44 
QuestionThreading and events Pin
Giorgi Nistor18-Jan-12 21:57
Giorgi Nistor18-Jan-12 21:57 
AnswerRe: Threading and events Pin
BobJanova19-Jan-12 0:57
BobJanova19-Jan-12 0:57 
GeneralRe: Threading and events Pin
Giorgi Nistor19-Jan-12 22:35
Giorgi Nistor19-Jan-12 22:35 
QuestionMaskedTextBox - Different behavior on different machines, Why? Pin
Michel8318-Jan-12 20:52
Michel8318-Jan-12 20:52 
AnswerRe: MaskedTextBox - Different behavior on different machines, Why? Pin
Eddy Vluggen19-Jan-12 0:27
professionalEddy Vluggen19-Jan-12 0:27 
AnswerRe: MaskedTextBox - Different behavior on different machines, Why? Pin
BobJanova19-Jan-12 0:51
BobJanova19-Jan-12 0:51 
GeneralRe: MaskedTextBox - Different behavior on different machines, Why? Pin
Michel8319-Jan-12 1:24
Michel8319-Jan-12 1:24 
QuestionBest Way To Handle Nulls Pin
Kevin Marois18-Jan-12 11:08
professionalKevin Marois18-Jan-12 11:08 
AnswerRe: Best Way To Handle Nulls Pin
PIEBALDconsult18-Jan-12 11:26
mvePIEBALDconsult18-Jan-12 11:26 

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.