internal static XTypedElement GetAnnotation(Type t, XElement xe) { XTypedElementWrapperAnnotation xoWrapperAnnotation = xe.Annotation <XTypedElementWrapperAnnotation>(); XTypedElement xObj = null; if (xoWrapperAnnotation != null) { //Return the root type if the element is annotated with the root xObj = xoWrapperAnnotation.typedElement; if (t.IsAssignableFrom(xObj.GetType())) { //Check if we are asking for element wrapper return(xObj); } } XTypedElementAnnotation xoAnnotation = xe.Annotation <XTypedElementAnnotation>(); if (xoAnnotation != null) { xObj = xoAnnotation.typedElement; if (t.IsAssignableFrom(xObj.GetType())) { //Check if we are asking for type return(xObj); } } return(null); }
internal static XTypedElement GetAnnotation(Type t, XElement xe) { XTypedElement xTypedElement; XTypedElementWrapperAnnotation xoWrapperAnnotation = xe.Annotation <XTypedElementWrapperAnnotation>(); XTypedElement xObj = null; if (xoWrapperAnnotation != null) { xObj = xoWrapperAnnotation.typedElement; if (t.IsAssignableFrom(xObj.GetType())) { xTypedElement = xObj; return(xTypedElement); } } XTypedElementAnnotation xoAnnotation = xe.Annotation <XTypedElementAnnotation>(); if (xoAnnotation != null) { xObj = xoAnnotation.typedElement; if (t.IsAssignableFrom(xObj.GetType())) { xTypedElement = xObj; return(xTypedElement); } } xTypedElement = null; return(xTypedElement); }
XTypedElement getTypedParent() { XElement parentElement = this.Untyped.Parent; if (parentElement != null) { XTypedElementAnnotation annotation = parentElement.Annotation <XTypedElementAnnotation>(); if (annotation != null) { return(annotation.typedElement); } } return(null); }
private XTypedElement getTypedParent() { XTypedElement xTypedElement; XElement parentElement = this.Untyped.Parent; if (parentElement != null) { XTypedElementAnnotation annotation = parentElement.Annotation <XTypedElementAnnotation>(); if (annotation != null) { xTypedElement = annotation.typedElement; return(xTypedElement); } } xTypedElement = null; return(xTypedElement); }