public static By GetByFor <T>(string element) { var propertyName = element; var type = typeof(T); var property = type.GetProperty(propertyName); var findsByAttributes = property.GetCustomAttributes(typeof(FindsByAttribute), inherit: false).Single() as FindsByAttribute; return(ByFactory.From(findsByAttributes)); }
public IdentityAttribute(params string[] identityStrings) { byIdentities = new By[identityStrings.Length]; for (int i = 0; i < identityStrings.Length; i++) { string identity = identityStrings[i]; int delimiterPos = identity.IndexOf(_IdentityDelimeter); String howStr = identity.Substring(0, delimiterPos); String usingStr = identity.Substring(delimiterPos + 1).TrimStart(); How how; if (Enum.TryParse(howStr, true, out how)) { byIdentities[i] = ByFactory.From(how, usingStr); } } }