How to recognize node or links in selected parts

GOXAM : how to recognize whether its a node or a link in selected parts of diagram

Could you provide a specific context in which you would want to know?

mydiagram.SelectedParts property is returning both the nodes and links selected (by ctrl+a / by mouse)
I want to update the properties of only nodes but in selected parts links are also appended to its giving me unable to cast… error

  foreach (var p in myDiagram.SelectedParts) {
    if (p is Node) ...
  }