/// <summary> /// Try invoking a constructor that takes a single string value or /// a single XElement value. /// <remarks> /// Creating a custom class to parse values either by string or /// from the XElement source itself, can be a slick way to make this /// system work for you. /// </remarks> /// </summary> public static bool TryInvoke(XElement source, string value, out T result) { result = default(T); if (null != StringInfo) { result = (T)StringInfo.Invoke(new object[] { value }); return(true); } if (null != XElementInfo) { result = (T)XElementInfo.Invoke(new object[] { source }); return(true); } return(false); }