Click here to Skip to main content
15,909,953 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
xingselex21-May-09 6:45
xingselex21-May-09 6:45 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
xingselex21-May-09 7:05
xingselex21-May-09 7:05 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
harold aptroot21-May-09 7:07
harold aptroot21-May-09 7:07 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
xingselex21-May-09 7:11
xingselex21-May-09 7:11 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
OriginalGriff21-May-09 8:31
mveOriginalGriff21-May-09 8:31 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
harold aptroot21-May-09 7:06
harold aptroot21-May-09 7:06 
GeneralRe: how to call 1 class method or constructor in other class ? Pin
musefan21-May-09 6:37
musefan21-May-09 6:37 
QuestionGet/Set for List<string> in C#</string> Pin
ipstefan21-May-09 3:07
ipstefan21-May-09 3:07 
Hi guys. I got a problem I cant find solution to anywhere over the internet..I might have missed something in my logic.
<pre>
      class DefComparing:DefCompareProperty
      {
            public void DefCompare()
            {
                  List<string> def_compare = new List<string>();
                  ********doing something to the list here******
DefCompareProperty df = new DefCompareProperty();
                  foreach (string s in def_compare)
                  {
                        df.SetDefComp(s);
                  }
            }
      }
</pre>
Then I want to use the def_compare list in another class.
<pre>
public class Aliniere
      {
            public List<string> def_compare = new List<string>();
            public void Aliniate()
            {
               ******doing some operations here****
               DefComparing newdefcomp = new DefComparing();
               newdefcomp.DefCompare();
               def_compare = df.GetDefComp();   //Trying to get the list from that other class

</pre>
What I tried to do is make Set/Get properties for the list.

<pre>
      class DefCompareProperty
      {
            private List<string> lst = new List<string>();

            public List<string> GetDefComp()
            {
                  return lst;
            }
            public void SetDefComp(string members)
            {
                  lst.Add(members);
            }
      }
</pre>

So the problem is I cant get the list from class1 to class 2 using class3(set/get). I am doing some mistake. Can you help?

Thanks in advance
AnswerRe: Get/Set for List in C# Pin
musefan21-May-09 3:12
musefan21-May-09 3:12 
GeneralRe: Get/Set for List in C# Pin
ipstefan21-May-09 3:15
ipstefan21-May-09 3:15 
GeneralRe: Get/Set for List in C# Pin
musefan21-May-09 3:20
musefan21-May-09 3:20 
AnswerRe: Get/Set for List in C# Pin
Anthony Mushrow21-May-09 3:18
professionalAnthony Mushrow21-May-09 3:18 
GeneralRe: Get/Set for List in C# Pin
ipstefan21-May-09 3:49
ipstefan21-May-09 3:49 
AnswerRe: Get/Set for List in C# Pin
Luc Pattyn21-May-09 3:36
sitebuilderLuc Pattyn21-May-09 3:36 
GeneralRe: Get/Set for List in C# Pin
musefan21-May-09 3:45
musefan21-May-09 3:45 
GeneralRe: Get/Set for List in C# Pin
PIEBALDconsult21-May-09 4:09
mvePIEBALDconsult21-May-09 4:09 
GeneralRe: Get/Set for List in C# Pin
Luc Pattyn21-May-09 4:21
sitebuilderLuc Pattyn21-May-09 4:21 
GeneralRe: Get/Set for List in C# Pin
musefan21-May-09 4:37
musefan21-May-09 4:37 
GeneralRe: Get/Set for List in C# Pin
Paddy Boyd21-May-09 5:24
Paddy Boyd21-May-09 5:24 
GeneralRe: Get/Set for List in C# Pin
Luc Pattyn21-May-09 5:30
sitebuilderLuc Pattyn21-May-09 5:30 
Questionexcel x-axis in Time format 00:00:00 using C# Pin
carnister21-May-09 2:49
carnister21-May-09 2:49 
QuestionSave to default program files folder Pin
Jon Henry21-May-09 2:30
Jon Henry21-May-09 2:30 
AnswerRe: Save to default program files folder Pin
musefan21-May-09 2:35
musefan21-May-09 2:35 
AnswerRe: Save to default program files folder [modified] Pin
Luc Pattyn21-May-09 3:41
sitebuilderLuc Pattyn21-May-09 3:41 
GeneralRe: Save to default program files folder Pin
Jon Henry21-May-09 13:00
Jon Henry21-May-09 13:00 

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.