Skip to content

Instantly share code, notes, and snippets.

@M-Yankov
Created October 11, 2017 12:01
Show Gist options
  • Save M-Yankov/8e9045ad46070e7a3a8c31cfb7ef8b63 to your computer and use it in GitHub Desktop.
Save M-Yankov/8e9045ad46070e7a3a8c31cfb7ef8b63 to your computer and use it in GitHub Desktop.
In C# you can set an attribute to the setter. It works in normal .NET 4.5
// Extracted from System.Web
public IPrincipal User
{
get
{
return this._principalContainer.Principal;
}
[SecurityPermission(SecurityAction.Demand, ControlPrincipal=true)]
set
{
this.SetPrincipalNoDemand(value);
}
}
// another one example
public int SampleGetSet
{
[Display(Name = "", Description = "")]
get { return sample; }
[Display(Name = "", Description = "")]
set { sample = value; }
}
// What is the purpose of that is a mistery for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment