⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profilepropertybindingcollection.cs

📁 AJAX 应用 实现页面的无刷新
💻 CS
字号:
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace AjaxControlToolkit
{
    /// <summary>
    /// Basic collection of ProfilePropertyBindings.
    /// 
    /// We need a special collection here to do notification back to the owning object so that
    /// the designer knows when things changed.
    /// 
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface", Justification = "IList<T> has a number of unnecessary methods for this special-purpose class")]
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1035:ICollectionImplementationsHaveStronglyTypedMembers", Justification="As above")]
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1039:ListsAreStronglyTyped", Justification="As above")]
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1058:TypesShouldNotExtendCertainBaseTypes", Justification="As above")]
    public class ProfilePropertyBindingCollection : CollectionBase
    {
        internal event EventHandler CollectionChanged;

        internal ProfilePropertyBindingCollection()
        {
        }

        public ProfilePropertyBinding this[int index]
        {
            get
            {
                return (ProfilePropertyBinding)InnerList[index];
            }
            set
            {
                InnerList[index] = value;
            }
        }

        public void Add(ProfilePropertyBinding binding) {
            InnerList.Add(binding);
        }

        public void Insert(int index, ProfilePropertyBinding binding)
        {
            InnerList.Insert(index, binding);
        }

        protected virtual void OnCollectionChanged(EventArgs e)
        {
            if (CollectionChanged != null)
            {
                CollectionChanged(this, e);
            }
        }

        public void Remove(ProfilePropertyBinding binding) {
            InnerList.Remove(binding);
        }

        protected override void OnInsertComplete(int index, object value)
        {
            base.OnInsertComplete(index, value);
            OnCollectionChanged(EventArgs.Empty);
        }

        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            base.OnSetComplete(index, oldValue, newValue);
            OnCollectionChanged(EventArgs.Empty);
        }

        protected override void OnRemoveComplete(int index, object value)
        {
            base.OnRemoveComplete(index, value);
            OnCollectionChanged(EventArgs.Empty);
        }

        protected override void OnClearComplete()
        {
            base.OnClearComplete();
            OnCollectionChanged(EventArgs.Empty);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -