Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
List<string> className = (from node in nodeList
                         where node.Attributes["class"] != null || !(string.IsNullOrEmpty(node.Attributes["class"].Value))
                         select new
                         {
                             classname = "." + node.Attributes["class"].Value.Trim().ToString()
                         }).ToList();

its converting to a List<string>
any suggestion!
Plz help
Posted
Updated 8-Mar-13 0:06am
v2

Do not create anonymous type, just select a string:

C#
List<string> className = (from node in nodeList
                         where node.Attributes["class"] != null || !(string.IsNullOrEmpty(node.Attributes["class"].Value))
                         select ("." + node.Attributes["class"].Value.Trim())
                         ).ToList();
 
Share this answer
 
v2
C#
List<string> className = (from node in nodeList
where node.Attributes["class"] != null || !(string.IsNullOrEmpty(node.Attributes["class"].Value))
select new
{
classname = "." + node.Attributes["class"].Value.Trim().ToString()
}).ToList<string>();

Try with this and let me know if it resolves your problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900