wow, its like resource management!
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1063 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
18
OpenRa.Core/Reflect.cs
Normal file
18
OpenRa.Core/Reflect.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Core
|
||||
{
|
||||
static class Reflect
|
||||
{
|
||||
public static T GetAttribute<T>(Type t)
|
||||
where T : Attribute
|
||||
{
|
||||
T[] attribs = (T[])t.GetCustomAttributes(typeof(T), false);
|
||||
if (attribs == null || attribs.Length == 0)
|
||||
return null;
|
||||
return attribs[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user