Do not create anonymous type, just select a string:
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();