custom_Attribute 1.0.6
See the version list below for details.
dotnet add package custom_Attribute --version 1.0.6
NuGet\Install-Package custom_Attribute -Version 1.0.6
<PackageReference Include="custom_Attribute" Version="1.0.6" />
<PackageVersion Include="custom_Attribute" Version="1.0.6" />
<PackageReference Include="custom_Attribute" />
paket add custom_Attribute --version 1.0.6
#r "nuget: custom_Attribute, 1.0.6"
#:package custom_Attribute@1.0.6
#addin nuget:?package=custom_Attribute&version=1.0.6
#tool nuget:?package=custom_Attribute&version=1.0.6
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Custom_ATTRIBUTE_create { public enum sex { male, female } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] public class SexAttribute : Attribute { sex _value; public SexAttribute(sex value) { this._value = value; } public override string ToString() { return "value of the paramater associated to the attribute: " + this._value; } public void helloWorld() { Console.WriteLine("Hello World from attribute class"); }
}
[Sex(sex.female)]
public class person
{
public int id { get; set; }
}
class Program
{
static void Main(string[] args)
{
Type t = typeof(person);
object[] o = Attribute.GetCustomAttributes(t);
foreach(SexAttribute o1 in o)
{
o1.helloWorld();
}
Console.Read();
}
}
}
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.