Let cls
be of type XmlNode
Following statement allows me to access child nodes:
foreach (XmlNode child in cls.ChildNodes)
Now when I try to use var:
foreach (var child in cls.ChildNodes)
then the type of child is not XmlNode
, only object. I cannot use child.NodeType
, compiler says:
object' does not contain a definition for 'NodeType
Why is this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…