CSharpTest.Net
PropertySerializer<T> Constructor
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Reflection Namespace > PropertySerializer<T> Class : PropertySerializer<T> Constructor

namePaths

Glossary Item Box

Creates a property serializer for the specified type T and optionally the properties specified.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal ParamArray namePaths() As String _
)
C# 
public PropertySerializer<T>( 
   params string[] namePaths
)

Parameters

namePaths

Example

Library/Library.Test/TestPropertySerializer.cs

C#Copy Code
PropertySerializer<HaveReadOnly> ser = new PropertySerializer<HaveReadOnly>();
try
{
    ser.GetType().InvokeMember("Serialize", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null,
        ser, new object[] { new object(), Dictionary });
}
catch (TargetInvocationException e)
{ Assert.AreEqual(typeof(NotSupportedException), e.InnerException.GetType()); }
try
{
    ser.GetType().InvokeMember("Deserialize", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null,
        ser, new object[] { new object(), Dictionary });
}
catch (TargetInvocationException e)
{ Assert.AreEqual(typeof(NotSupportedException), e.InnerException.GetType()); }
VB.NETCopy Code
Dim ser As New PropertySerializer(Of HaveReadOnly)()
Try
    ser.[GetType]().InvokeMember("Serialize", System.Reflection.BindingFlags.[Public] Or System.Reflection.BindingFlags.InvokeMethod Or System.Reflection.BindingFlags.Instance, Nothing, ser, New Object() {New Object(), Dictionary})
Catch e As TargetInvocationException
    Assert.AreEqual(GetType(NotSupportedException), e.InnerException.[GetType]())
End Try
Try
    ser.[GetType]().InvokeMember("Deserialize", System.Reflection.BindingFlags.[Public] Or System.Reflection.BindingFlags.InvokeMethod Or System.Reflection.BindingFlags.Instance, Nothing, ser, New Object() {New Object(), Dictionary})
Catch e As TargetInvocationException
    Assert.AreEqual(GetType(NotSupportedException), e.InnerException.[GetType]())
End Try

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys