Pomona.Common.TypeSystem.TypeSpec.TryGetPropertyByName C# (CSharp) Method

TryGetPropertyByName() public method

public TryGetPropertyByName ( string propertyName, bool ignoreCase, PropertySpec &propertySpec ) : bool
propertyName string
ignoreCase bool
propertySpec PropertySpec
return bool
        public bool TryGetPropertyByName(string propertyName, bool ignoreCase, out PropertySpec propertySpec)
        {
            var stringComparison = ignoreCase
                ? StringComparison.InvariantCultureIgnoreCase
                : StringComparison.InvariantCulture;

            // TODO: Possible to optimize here by putting property names in a dictionary
            propertySpec = Properties.FirstOrDefault(x => string.Equals(x.Name, propertyName, stringComparison));
            return propertySpec != null;
        }