thank you Mark this is the correct code but I need just how can i call a function in this example list for the generics T(((T)item) .list) or use it like the class( myList) plz reply me as soon as possible //-------------------------- myList ///.list =={1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90} [0]myList>///.list =={1,2,3,4,5,6,7,8,9} [0]=myList;///.list =={1,2,3} [0]=1; [1]=2; [2]=3; [1]=myList;///.list =={4,5,6} [0]=4; [1]=5; [2]=6; [2]=myList;///.list =={7,8,9} [0]=7; [1]=8; [2]=9; [1]myList>///.list =={10,20,30,40,50,60,70,80,90} [0]=myList;///.list =={10,20,30} [0]=10; [1]=20; [2]=30; [1]=myList;///.list =={40,50,60} [0]=40; [1]=50; [2]=60; [2]=myList;///.list =={40,50,60} [0]=70; [1]=80; [2]=90; //--------------------------- thank you in advance, example: class myList { Array MyArray; public myList() { _MyArray=new Array(); } public void add(T value) { _MyArray.add(value); } public object[] List { //here is the problem //Array temp=new Array(); //if T is myList<> //{ // foreach(T item in _MaArray) // { // temp.addRange(((T)item) .list);//use list method // } //} //else //{ // foreach(T item in _MaArray) // { // temp.addRange((object)item); // } //} } } { myList> AList=new myList>(); myList BList=new myList(); BList.add(1); BList.add(2); BList.add(3); AList.add(BList); //BList.list === {1,2,3} BList=new myList(); BList.add(4); BList.add(5); BList.add(6); AList.add(BList); //BList.list === {4,5,6} //AList.list === {1,2,3,4,5,6}
abedo1982
Posts
-
Generics class -
Generics classHi All I'm Create a Generics class and i need to write a function return lis of object stored on it but i have a problem as following: I want to compare if the Generics type is the same of the created class and if its the same i want to use a same method and if not the same type of the created class return the object value . example: class myList { Array MyArray; public myList() { _MyArray=new Array(); } public void add(T value) { _MyArray.add(value); } public object[] List { //here is the problem //Array temp=new Array(); //if T is myList<> //{ // foreach(T item in _MaArray) // { // temp.addRange(item .list);//use list method // } //} //else //{ // foreach(T item in _MaArray) // { // temp.addRange((object)item); // } //} } } { myList AList=new myList(); myList BList=new myList(); BList.add(1); BList.add(2); BList.add(3); AList.add(BList); //BList.list === {1,2,3} BList=new myList(); BList.add(4); BList.add(5); BList.add(6); AList.add(BList); //BList.list === {4,5,6} //AList.list === {1,2,3,4,5,6} Note:I know there is an exist class List but This is just an example i need to know how can i do the list function that's it thank you,
-
use other name of classfirst thank you for reply Nocc is the new name i want to use it Like Myclass i do not know what's the command to do something like this thanks in advance,
-
use other name of classI want to use other name of class for example: this is a simple class: class Myclass { private int _No; public Myclass() { } public int No { get{return _No;} } } I want to use other name a new name (Nocc) for Myclass Nocc N1=new Nocc(); N1.No=91;
-
DLL filethank you so much But I have another problem how can I set the assemply info(Properties Folder) for the Source Code or the Dll output file Best Regards ,
-
DLL fileThank you very much
-
DLL fileI don't need to create it Manually I want do it Programmatically Can I do it,
-
DLL filecan i program an application to generate dll file as an output ,for example: program generate the following code : class cars { private string _Model; Private string _Type; public Cars() { } public string Model { get{return _Model;} set{_Model=Value;} } public string Model { get{return _Model;} set{_Model=Value;} } } I need to convert the above code to a dll(Cars.dll) file that simply can use it: Please help me to do it, Thank you very much,