Enum htmlTextWriterStyle modified then stored in another similar container

arandapc

New Member
I was searching a data source for all common style types available in asp.net and \[code\]htmlTextWriterStyle\[/code\] appears to have all I could ask for.if there's other source I could use I'll be happy to know .what i was trying to achieve is to copy it's values to any other type of data "container"that is differ from enum , more flexible though it's value still can be accessed via \[code\]var test = name.value ;\[/code\]like in \[code\]string MyElmWidth = htmlTextWriterStyle.width.ToString();\[/code\]and could be assigned like a list so I could dynamically populate it via foreach loop(not having to hard Code variables & values)a collection or something rather a list like in this code:\[code\] public static List<string> EnumToStrLst<T>() { Array values = Enum.GetValues(typeof(T)); T[] result = (T[])values; List<string> strlst = new List<string>(); foreach (var item in result) { string e = item.ToString(); strlst.Add(e); } return strlst; }\[/code\]populating a \[code\]List<string>\[/code\] is then done this way: \[code\]List<string> testLstStr = EnumToStrLst<htmlTextWriterStyle>()\[/code\]though the Whole issue here is the access to it's values- a not so elegant way as in an enum:\[code\]testLstStr.elementAt(index) \[/code\]opposed to\[code\]enumName.valueName\[/code\]
 
Back
Top