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:
chrisf
2007-06-23 17:59:13 +00:00
parent 63caabee27
commit b2755e0260
10 changed files with 270 additions and 0 deletions

18
OpenRa.Core/Reflect.cs Normal file
View 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];
}
}
}