System.Configuration.ConfigurationElement.PropertyFileName C# (CSharp) Метод

PropertyFileName() приватный Метод

private PropertyFileName ( string propertyName ) : string
propertyName string
Результат string
        internal string PropertyFileName(string propertyName) {
            PropertySourceInfo p = (PropertySourceInfo)PropertyInfoInternal(propertyName);
            if (p == null)
                p = (PropertySourceInfo)PropertyInfoInternal(String.Empty); // Get the filename of the parent if prop is not there
            if (p == null)
                return String.Empty;
            return p.FileName;
        }

Usage Example

 private void BaseAdd(ConfigurationElement element, bool throwIfExists, bool ignoreLocks)
 {
     bool flagAsReplaced = false;
     bool internalAddToEnd = this.internalAddToEnd;
     if (this.IsReadOnly())
     {
         throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_read_only"));
     }
     if (base.LockItem && !ignoreLocks)
     {
         throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_element_locked", new object[] { this._addElement }));
     }
     object elementKeyInternal = this.GetElementKeyInternal(element);
     int index = -1;
     for (int i = 0; i < this._items.Count; i++)
     {
         Entry entry = (Entry) this._items[i];
         if (this.CompareKeys(elementKeyInternal, entry.GetKey(this)))
         {
             if (((entry._value != null) && entry._value.LockItem) && !ignoreLocks)
             {
                 throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_collection_item_locked"));
             }
             if ((entry._entryType != EntryType.Removed) && throwIfExists)
             {
                 if (!element.Equals(entry._value))
                 {
                     throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_collection_entry_already_exists", new object[] { elementKeyInternal }), element.PropertyFileName(""), element.PropertyLineNumber(""));
                 }
                 entry._value = element;
                 return;
             }
             if (entry._entryType != EntryType.Added)
             {
                 if (((this.CollectionType == ConfigurationElementCollectionType.AddRemoveClearMap) || (this.CollectionType == ConfigurationElementCollectionType.AddRemoveClearMapAlternate)) && ((entry._entryType == EntryType.Removed) && (this._removedItemCount > 0)))
                 {
                     this._removedItemCount--;
                 }
                 entry._entryType = EntryType.Replaced;
                 flagAsReplaced = true;
             }
             if (!internalAddToEnd && (this.CollectionType != ConfigurationElementCollectionType.AddRemoveClearMapAlternate))
             {
                 if (!ignoreLocks)
                 {
                     element.HandleLockedAttributes(entry._value);
                     element.MergeLocks(entry._value);
                 }
                 entry._value = element;
                 this.bModified = true;
                 return;
             }
             index = i;
             if (entry._entryType == EntryType.Added)
             {
                 internalAddToEnd = true;
             }
             break;
         }
     }
     if (index >= 0)
     {
         this._items.RemoveAt(index);
         if ((this.CollectionType == ConfigurationElementCollectionType.AddRemoveClearMapAlternate) && (index > ((this.Count + this._removedItemCount) - this._inheritedCount)))
         {
             this._inheritedCount--;
         }
     }
     this.BaseAddInternal(internalAddToEnd ? -1 : index, element, flagAsReplaced, ignoreLocks);
     this.bModified = true;
 }
All Usage Examples Of System.Configuration.ConfigurationElement::PropertyFileName