Permalink
Browse files

Merge pull request #1293 from mooniscrazy/patch-1

Update MonoGame.Framework/Content/ContentExtensions.cs
  • Loading branch information...
2 parents 6691dd7 + f33585e commit 58a37cdd3914f4168c0765abdf68f1c1ed6f1d02 @tomspilman tomspilman committed Feb 18, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 MonoGame.Framework/Content/ContentExtensions.cs
@@ -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);
@@ -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);

0 comments on commit 58a37cd

Please sign in to comment.