Created
October 11, 2017 12:01
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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