forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReflectionExtensions.cs
More file actions
61 lines (50 loc) · 1.88 KB
/
ReflectionExtensions.cs
File metadata and controls
61 lines (50 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Reflection;
using Proxy = ServiceStack.Common.ReflectionExtensions;
namespace ServiceStack.Common.Extensions
{
public static class ReflectionExtensions
{
public static To PopulateWith<To, From>(this To to, From from)
{
return Proxy.PopulateWith(to, from);
}
public static To PopulateWithNonDefaultValues<To, From>(this To to, From from)
{
return Proxy.PopulateWithNonDefaultValues(to, from);
}
public static To PopulateFromPropertiesWithAttribute<To, From, TAttr>(this To to, From from)
{
return Proxy.PopulateFromPropertiesWithAttribute<To, From, TAttr>(to, from);
}
public static T TranslateTo<T>(this object from)
where T : new()
{
return Proxy.TranslateTo<T>(from);
}
public static TAttribute FirstAttribute<TAttribute>(this Type type)
{
return Proxy.FirstAttribute<TAttribute>(type);
}
public static TAttribute FirstAttribute<TAttribute>(this Type type, bool inherit)
{
return Proxy.FirstAttribute<TAttribute>(type, inherit);
}
public static TAttribute FirstAttribute<TAttribute>(this PropertyInfo propertyInfo)
{
return Proxy.FirstAttribute<TAttribute>(propertyInfo);
}
public static TAttribute FirstAttribute<TAttribute>(this PropertyInfo propertyInfo, bool inherit)
{
return Proxy.FirstAttribute<TAttribute>(propertyInfo, inherit);
}
public static bool IsGenericType(this Type type)
{
return Proxy.IsGenericType(type);
}
public static Type FirstGenericTypeDefinition(this Type type)
{
return Proxy.FirstGenericTypeDefinition(type);
}
}
}