当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurationElement.PropertyFileName方法代码示例

本文整理汇总了C#中System.Configuration.ConfigurationElement.PropertyFileName方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationElement.PropertyFileName方法的具体用法?C# ConfigurationElement.PropertyFileName怎么用?C# ConfigurationElement.PropertyFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Configuration.ConfigurationElement的用法示例。


在下文中一共展示了ConfigurationElement.PropertyFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BaseAdd

 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;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:71,代码来源:ConfigurationElementCollection.cs

示例2: BaseAdd

        private void BaseAdd(int index, ConfigurationElement element, bool ignoreLocks)
        {
            if (IsReadOnly())
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_read_only));
            }
            if (index < -1)
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.IndexOutOfRange, index));
            }

            if ((index != -1) &&
                (CollectionType == ConfigurationElementCollectionType.AddRemoveClearMap ||
                CollectionType == ConfigurationElementCollectionType.AddRemoveClearMapAlternate))
            {

                // If it's an AddRemoveClearMap*** collection, turn the index passed into into a real internal index
                int realIndex = 0;

                if (index > 0)
                {
                    foreach (Entry entryfound in _items)
                    {
                        if (entryfound._entryType != EntryType.Removed)
                        {
                            index--;
                        }
                        if (index == 0)
                        {
                            break;
                        }
                        realIndex++;
                    }
                    index = ++realIndex;
                }
                // check for duplicates
                Object key = GetElementKeyInternal(element);
                foreach (Entry entry in _items)
                {
                    if (CompareKeys(key, entry.GetKey(this)))
                    {
                        if (entry._entryType != EntryType.Removed)
                        {
                            if (!element.Equals(entry._value))
                            {
                                throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_collection_entry_already_exists, key),
                                        element.PropertyFileName(""), element.PropertyLineNumber(""));
                            }
                            return;
                        }
                    }
                }

            }

            BaseAddInternal(index, element, false, ignoreLocks);
        }
开发者ID:kichalla,项目名称:systemconfigurationport,代码行数:57,代码来源:ConfigurationElementCollection.cs


注:本文中的System.Configuration.ConfigurationElement.PropertyFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。