/// <summary> /// Gets a PrimitiveExpression and a parenting property provided the PrimitiveExpression is of type System.String and the caret is inside that string. /// Returns true if both values are found and the contents of the string matches the name of the property. /// </summary> private static bool GetPrimitiveExpressionAndProperty(LanguageElement element, out PrimitiveExpression primitiveExpression, out Property property) { property = null; primitiveExpression = element as PrimitiveExpression; if (primitiveExpression == null) { return(false); } if (primitiveExpression.ExpressionTypeName != "System.String") { return(false); } property = primitiveExpression.GetParentProperty(); if (property == null) { return(false); } return(property.Name == (string)primitiveExpression.PrimitiveValue); }
/// <summary> /// Gets a PrimitiveExpression and a parenting property provided the PrimitiveExpression is of type System.String and the caret is inside that string. /// Returns true if both values are found and the contents of the string matches the name of the property. /// </summary> private static bool GetPrimitiveExpressionAndProperty(LanguageElement element, out PrimitiveExpression primitiveExpression, out Property property) { property = null; primitiveExpression = element as PrimitiveExpression; if (primitiveExpression == null) return false; if (primitiveExpression.ExpressionTypeName != "System.String") return false; property = primitiveExpression.GetParentProperty(); if (property == null) return false; return property.Name == (string)primitiveExpression.PrimitiveValue; }