System.Diagnostics.TraceUtils.VerifyAttributes C# (CSharp) Method

VerifyAttributes() static private method

static private VerifyAttributes ( IDictionary attributes, String supportedAttributes, object parent ) : void
attributes IDictionary
supportedAttributes String
parent object
return void
        internal static void VerifyAttributes(IDictionary attributes, String[] supportedAttributes, object parent) {
            foreach (string key in attributes.Keys) {
                bool found = false;
                if (supportedAttributes != null) {
                    for (int i=0; i<supportedAttributes.Length; i++) {
                        if (supportedAttributes[i] == key)
                            found = true;
                    }
                }
                if (!found)
                    throw new ConfigurationErrorsException(SR.GetString(SR.AttributeNotSupported, key, parent.GetType().FullName));
            }
        }
        

Usage Example

        internal void SetAttributes(Hashtable attribs)
        {
            TraceUtils.VerifyAttributes(attribs, GetSupportedAttributes(), this);

            attributes          = new StringDictionary();
            attributes.contents = attribs;
        }
All Usage Examples Of System.Diagnostics.TraceUtils::VerifyAttributes