clientcssresourceattribute.cs

来自「AJAX 应用 实现页面的无刷新」· CS 代码 · 共 46 行

CS
46
字号
using System;
using System.Collections.Generic;
using System.Text;

namespace AjaxControlToolkit
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments", Justification = "The composition of baseType and resourceName is available as ResourcePath")]
    public sealed class ClientCssResourceAttribute : Attribute
    {
        private string _resourcePath;
        private int _loadOrder;

        public ClientCssResourceAttribute(Type baseType, string resourceName)
        {
            if (baseType == null) throw new ArgumentNullException("baseType");
            if (resourceName == null) throw new ArgumentNullException("resourceName");

            string typeName = baseType.FullName;
            int lastDot = typeName.LastIndexOf('.');
            if (lastDot != -1)
            {
                typeName = typeName.Substring(0, lastDot);
            }
            _resourcePath = typeName + '.' + resourceName;
        }

        public ClientCssResourceAttribute(string fullResourceName)
        {
            if (fullResourceName == null) throw new ArgumentNullException("fullResourceName");
            _resourcePath = fullResourceName;
        }

        public string ResourcePath
        {
            get { return _resourcePath; }
        }

        public int LoadOrder
        {
            get { return _loadOrder; }
            set { _loadOrder = value; }
        }
    }
}

⌨️ 快捷键说明

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