C# 自我学习总结

AttributeUsage : from  AttributeUsage

AttributeUsage 类的作用就是帮助我们控制定制特性的使用。其实AttributeUsage类就是描述了一个定制特性如和被使用。

  C# AttributeUsage的使用要明白: [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]

  AttributeUsage有三个属性,我们可以把它放置在定制属性前面。第一个属性是:

  ◆ValidOn 
   
  通过这个属性,我们能够定义定制特性应该在何种程序实体前放置。一个属性可以被放置的所有程序实体在AttributeTargets enumerator中列出。通过OR操作我们可以把若干个AttributeTargets值组合起来。

  ◆AllowMultiple 
   
  这个属性标记了我们的定制特性能否被重复放置在同一个程序实体前多次。

  ◆Inherited 
   

  我们可以使用这个属性来控制定制特性的继承规则。它标记了我们的特性能否被继承。

HandleErrorAttribute: from HandleErrorAttribute

ExceptionContext : from ExceptionContext

HttpException : from HttpException

JsonResult : from  JsonResult

HandleErrorInfo : from HandleErrorInfo

HttpResponse : from HttpResponse

AuthorizeAttribute : from AuthorizeAttribute

AuthorizationContext : from AuthorizationContext

AllowAnonymousAttribute : from AllowAnonymousAttribute

FormsAuthentication : from FormsAuthentication

ModelState : from ModelState

FormsAuthentication.SetAuthCookie : from FormsAuthentication.SetAuthCookie

SelectListItem : from SelectListItem

SelectList : from SelectList

ViewBag : from ViewBag

AreaRegistration : from AreaRegistration

NetworkCredential : from NetworkCredential

FtpWebRequest : from FtpWebRequest

你可能感兴趣的:(C#)