开发者

Work with generic

开发者 https://www.devze.com 2023-03-13 04:03 出处:网络
I have a class look like this: public class NamSetup: INameSetup { static List<Name> nbames= new List<Name>();

I have a class look like this:

public class NamSetup: INameSetup
{
     static List<Name> nbames= new List<Name>();
     ....
     public List<Name> GetClients()
        {
            return names;
        }

     public List<Name> AddName(Name name)
     {
        names.Add(name);
        return GetClients();
     }
 }

I just want to make another class with names: myName.cs Inside myName.cs and want to call the AddName methode above. Do you kn开发者_如何学Pythonow to to do it?

Thank you in advance


 class MyName
 {
    public MyName()
    { 
        NamSetup nm = new NamSetup(); 
        nm.AddName(new Name());
    }
 }
0

精彩评论

暂无评论...
验证码 换一张
取 消