Files
OpenRA/OpenRa.Core/Reflect.cs
chrisf b2755e0260 wow, its like resource management!
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1063 993157c7-ee19-0410-b2c4-bb4e9862e678
2007-06-23 17:59:13 +00:00

19 lines
363 B
C#

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];
}
}
}