i'm working on program having 3 class library file in project.
after loading class library, return project , use selected library rest of project.
it's configuration project. - c#
using myref; //class1 using newref; //class2 using revisionref; //class3 public static string mchoose { get; set; } public string myconfiguration(string pactivity) { string _retval = ""; if (pactivity== "class1") { class1 _class1 = new class1(); _retval = _class1; } else if (pactivity== "class2") { class2 _class2 = new class2(); _retval = _class2; } else if(pactivity== "class3") { class3 _class3 = new class3(); _retval = _class3; } return _retval; }
i suspect class names wrong eg class1 should of type myref can't assign object string eg _retval = _class1; if want return class whole method have rewritten return object of whatever class decide create. want this:
switch (pactivity) { case "class1": myref _class1 = new myref(); break; case "class2": newref _class2 = new newref(); break; case "class3": revisionref _class3 = new revisionref(); break; default: break; } then whichever class created have methods of class type.
Comments
Post a Comment