Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1293 from mooniscrazy/patch-1
Update MonoGame.Framework/Content/ContentExtensions.cs
  • Loading branch information
tomspilman committed Feb 18, 2013
2 parents 6691dd7 + f33585e commit 58a37cd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions MonoGame.Framework/Content/ContentExtensions.cs
Expand Up @@ -25,7 +25,11 @@ public static ConstructorInfo GetDefaultConstructor(this Type type)
public static PropertyInfo[] GetAllProperties(this Type type)
{
#if WINRT
return type.GetTypeInfo().DeclaredProperties.ToArray();
PropertyInfo[] infos= type.GetTypeInfo().DeclaredProperties.ToArray();
var nonStaticPropertyInfos = from p in infos
where (p.GetMethod != null) && (!p.GetMethod.IsStatic)
select p;
return nonStaticPropertyInfos.ToArray();
#else
var attrs = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
return type.GetProperties(attrs);
Expand All @@ -36,7 +40,11 @@ public static PropertyInfo[] GetAllProperties(this Type type)
public static FieldInfo[] GetAllFields(this Type type)
{
#if WINRT
return type.GetTypeInfo().DeclaredFields.ToArray();
FieldInfo[] fields= type.GetTypeInfo().DeclaredFields.ToArray();
var nonStaticFields = from field in fields
where !field.IsStatic
select field;
return nonStaticFields.ToArray();
#else
var attrs = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
return type.GetFields(attrs);
Expand Down

0 comments on commit 58a37cd

Please sign in to comment.