2
Answers

About creating objects

hakan aydogan

hakan aydogan

13y
12k
1
Hi all,

I could decide what to search, but anyway I could not find anything related. 

My problem is that I have lets say an array. And I want to create objects but I want the names from the array. I will put this into an example;



		XmlElement newSql = xmlDoc.CreateElement(obj.GetType().Name);
		//scon is a XML element 
		//I am getting the attribute list of the element 
		//pi array takes the attributes of the scon XML element
                PropertyInfo[] pi = scon.GetType(.GetProperties();               
                
		for (int i = 0; i < pi.Length; i++)
                {
		    //I want to create objects automatically from the vales within the pi array !!!
                    XmlElement PropertyList[i] = xmlDoc.CreateElement(pi[i].ToString());
                }
 
Answers (2)