Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TypeSupport/TypeSupport/Extensions/PropertyOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ public enum PropertyOptions : byte
/// Properties that contain a collection indexer
/// </summary>
HasIndexer = 16,
/// <summary>
/// Do not include compiler generated types
/// </summary>
NoCompilerGenerated = 32,
}
}
5 changes: 5 additions & 0 deletions TypeSupport/TypeSupport/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace TypeSupport.Extensions
{
Expand Down Expand Up @@ -65,7 +66,11 @@ public static ICollection<ExtendedProperty> GetProperties(this Type type, Proper
if (options.HasFlag(PropertyOptions.HasIndexer))
returnProperties = returnProperties.Where(x => x.GetIndexParameters().Any());

if (options.HasFlag(PropertyOptions.NoCompilerGenerated))
returnProperties = returnProperties.Where(x => !x.GetGetMethod(true).IsDefined(typeof(CompilerGeneratedAttribute), true));

return returnProperties
.Where(x => !(x.Name == "EqualityContract" && x.PropertyType == typeof(Type)))
.Select(x => new ExtendedProperty(x, propogateTypeSupportOptions)).ToList();
}

Expand Down