Created
July 12, 2015 10:15
-
-
Save sholfen/513ed73ab68af578191e to your computer and use it in GitHub Desktop.
Attribute Class Tip: AttributeUsage
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace AttributeTestConsoleApplication | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
} | |
} | |
[AttributeUsage(AttributeTargets.Class)] | |
public class TestClassAttribute : Attribute | |
{ | |
} | |
[AttributeUsage(AttributeTargets.Property)] | |
public class TestPropertyAttribute : Attribute | |
{ | |
} | |
[AttributeUsage(AttributeTargets.Method)] | |
public class TestMethodAttribute : Attribute | |
{ | |
} | |
[TestClass] | |
public class TestClass | |
{ | |
[TestProperty] | |
public string Field1 { get; set; } | |
[TestMethod] | |
public void Foo() | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment