System.Windows.Automation.AutomationElement.TryGetCachedPattern C# (CSharp) Method

TryGetCachedPattern() public method

public TryGetCachedPattern ( AutomationPattern pattern, object &patternObject ) : bool
pattern AutomationPattern
patternObject object
return bool
        public bool TryGetCachedPattern(AutomationPattern pattern, out object patternObject)
        {
            patternObject = null;
            Utility.ValidateArgumentNonNull(pattern, "pattern");
            try
            {
                object nativePattern = this._obj.GetCachedPattern(pattern.Id);
                patternObject = Utility.WrapObjectAsPattern(this, nativePattern, pattern, true /* cached */);
                return (patternObject != null);
            }
            catch (System.Runtime.InteropServices.COMException e)
            {
                Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; }
            }

        }