C# Class Jayrock.Json.Conversion.CustomTypeDescriptor

Provides an ICustomTypeDescriptor implementation on top of the public read/write fields and properties of a given type.
Inheritance: System.ComponentModel.ICustomTypeDescriptor
Datei anzeigen Open project: atifaziz/Jayrock Class Usage Examples

Public Methods

Method Description
CreateProperty ( FieldInfo field ) : System.ComponentModel.PropertyDescriptor
CreateProperty ( PropertyInfo property ) : System.ComponentModel.PropertyDescriptor
CustomTypeDescriptor ( Type type ) : System
CustomTypeDescriptor ( Type type, MemberInfo members ) : System
CustomTypeDescriptor ( Type type, MemberInfo members, string names ) : System
GetAttributes ( ) : System.ComponentModel.AttributeCollection
GetClassName ( ) : string
GetComponentName ( ) : string
GetConverter ( ) : System.ComponentModel.TypeConverter
GetDefaultEvent ( ) : System.ComponentModel.EventDescriptor
GetDefaultProperty ( ) : System.ComponentModel.PropertyDescriptor
GetEditor ( Type editorBaseType ) : object
GetEvents ( ) : System.ComponentModel.EventDescriptorCollection
GetEvents ( Attribute attributes ) : System.ComponentModel.EventDescriptorCollection
GetProperties ( ) : System.ComponentModel.PropertyDescriptorCollection
GetProperties ( Attribute attributes ) : System.ComponentModel.PropertyDescriptorCollection
GetPropertyOwner ( System.ComponentModel.PropertyDescriptor pd ) : object
TryCreateForAnonymousClass ( Type type ) : CustomTypeDescriptor

Private Methods

Method Description
AnyObjectByTypeName ( object objects, string typeNameSought ) : bool
CustomTypeDescriptor ( Type type, bool isAnonymousClass, MemberInfo members, string names ) : System
FindFirstObjectByTypeName ( object objects, string typeNameSought ) : object
LikeAnonymousClass ( Type type ) : bool

Forward-compatible way to see if the given type is an anonymous class (introduced since C# 3.0).

There is no sure shot method so we have rely to rely on a heuristic approach by looking for a few known characteristics. Note also that we take a "duck" approach to look for the CompilerGenerated attribute under .NET Framework 1.x, which does not seem like an appaling idea considering that the C# compiler does the same with ExtensionAttribute when it comes to extension methods.

Method Details

CreateProperty() public static method

public static CreateProperty ( FieldInfo field ) : System.ComponentModel.PropertyDescriptor
field System.Reflection.FieldInfo
return System.ComponentModel.PropertyDescriptor

CreateProperty() public static method

public static CreateProperty ( PropertyInfo property ) : System.ComponentModel.PropertyDescriptor
property System.Reflection.PropertyInfo
return System.ComponentModel.PropertyDescriptor

CustomTypeDescriptor() public method

public CustomTypeDescriptor ( Type type ) : System
type System.Type
return System

CustomTypeDescriptor() public method

public CustomTypeDescriptor ( Type type, MemberInfo members ) : System
type System.Type
members System.Reflection.MemberInfo
return System

CustomTypeDescriptor() public method

public CustomTypeDescriptor ( Type type, MemberInfo members, string names ) : System
type System.Type
members System.Reflection.MemberInfo
names string
return System

GetAttributes() public method

public GetAttributes ( ) : System.ComponentModel.AttributeCollection
return System.ComponentModel.AttributeCollection

GetClassName() public method

public GetClassName ( ) : string
return string

GetComponentName() public method

public GetComponentName ( ) : string
return string

GetConverter() public method

public GetConverter ( ) : System.ComponentModel.TypeConverter
return System.ComponentModel.TypeConverter

GetDefaultEvent() public method

public GetDefaultEvent ( ) : System.ComponentModel.EventDescriptor
return System.ComponentModel.EventDescriptor

GetDefaultProperty() public method

public GetDefaultProperty ( ) : System.ComponentModel.PropertyDescriptor
return System.ComponentModel.PropertyDescriptor

GetEditor() public method

public GetEditor ( Type editorBaseType ) : object
editorBaseType System.Type
return object

GetEvents() public method

public GetEvents ( ) : System.ComponentModel.EventDescriptorCollection
return System.ComponentModel.EventDescriptorCollection

GetEvents() public method

public GetEvents ( Attribute attributes ) : System.ComponentModel.EventDescriptorCollection
attributes System.Attribute
return System.ComponentModel.EventDescriptorCollection

GetProperties() public method

public GetProperties ( ) : System.ComponentModel.PropertyDescriptorCollection
return System.ComponentModel.PropertyDescriptorCollection

GetProperties() public method

public GetProperties ( Attribute attributes ) : System.ComponentModel.PropertyDescriptorCollection
attributes System.Attribute
return System.ComponentModel.PropertyDescriptorCollection

GetPropertyOwner() public method

public GetPropertyOwner ( System.ComponentModel.PropertyDescriptor pd ) : object
pd System.ComponentModel.PropertyDescriptor
return object

TryCreateForAnonymousClass() public static method

public static TryCreateForAnonymousClass ( Type type ) : CustomTypeDescriptor
type System.Type
return CustomTypeDescriptor