using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;
using WcfServiceLibrary1;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
MemberInfo info = typeof(Steden).GetProperty("ID"); //GetMethod
TestAttribute t = (TestAttribute)Attribute.GetCustomAttribute(info, typeof(TestAttribute));
Console.WriteLine(t.Name+"====="+t.Paw);
}
}
[Test("A1",Paw ="pp")]
public class Steden
{
[Test("OO",Paw ="OO")]
public void Get()
{
}
[Test("ID", Paw = "ID_Paw")]
public int ID { get; set; }
}
public class TestAttribute : Attribute
{
public TestAttribute(string _name)
{
this.Name = _name;
}
public string Name { get; set; }
public string Paw { get; set; }
}
}
Attribute
最新推荐文章于 2024-04-11 20:45:28 发布