using System;
public enum RemoteServers
{
A,
B,
C
}
public class RemoteObjectAttribute : Attribute
{
public RemoteObjectAttribute(RemoteServers Server)
{
this.server = Server;
}
protected RemoteServers server;
public string Server
{
get
{
return RemoteServers.GetName(
typeof(RemoteServers), this.server);
}
}
}
[RemoteObject(RemoteServers.C)]
class MyRemotableClass
{
}
class Test
{
[STAThread]
static void Main(string[] args)
{
Type type = typeof(MyRemotableClass);
foreach (Attribute attr in type.GetCustomAttributes(true))
{
RemoteObjectAttribute remoteAttr = attr as RemoteObjectAttribute;
if (null != remoteAttr)
{
Console.WriteLine(remoteAttr.Server);
}
}
}
}