UnitTests/BinarySerialisationVersioningTests.cs
/// <summary>
/// This calls the BinarySerialisationCloner Deserialise method but populates the generic type parameter with a runtime type value
/// </summary>
This calls the BinarySerialisationCloner Deserialise method but populates the generic type parameter with a runtime type value
This calls the BinarySerialisationCloner Deserialise method but populates the generic type parameter with a runtime type value
private static object Deserialise(byte[] serialisedData, Type type, IDeserialisationTypeConverter[] optionalTypeConverters = null)
		{
			var genericDeserialiseMethod = typeof(BinarySerialisation).GetMethod(nameof(Deserialise), new[] { typeof(byte[]), typeof(IDeserialisationTypeConverter[]) }).MakeGenericMethod(type);
			try
			{
				return genericDeserialiseMethod.Invoke(null, new object[] { serialisedData, optionalTypeConverters ?? new IDeserialisationTypeConverter[0] });
			}
			catch (TargetInvocationException e)
			{
				if (e.InnerException != null)
					throw e.InnerException;
				throw;
			}
		}
private static object Deserialise ( byte [ ] serialisedData , Type type , IDeserialisationTypeConverter [ ] optionalTypeConverters = null ) { var genericDeserialiseMethod = typeof ( BinarySerialisation ) . GetMethod ( nameof ( Deserialise ) , new [ ] { typeof ( byte [ ] ) , typeof ( IDeserialisationTypeConverter [ ] ) } ) . MakeGenericMethod ( type ) ; try { return genericDeserialiseMethod . Invoke ( null , new object [ ] { serialisedData , optionalTypeConverters ?? new IDeserialisationTypeConverter [ 0 ] } ) ; } catch ( TargetInvocationException e ) { if ( e . InnerException != null ) throw e . InnerException ; throw ; } }
This calls the BinarySerialisationCloner Deserialise method but populates the generic type parameter with a runtime type value
This calls the BinarySerialisationCloner Deserialise method but populates the generic type parameter with a runtime type value
// If an exception is thrown within the "Invoke" call then it will be wrapped in a TargetInvocationException - this isn't very helpful, the tests above // that expect exceptions should be able to specify what exception should occur and not worry about unwrapping it from the TargetInvocationException. // To avoid that, the unwrapping is done here.
serialisedData
byte[]
type
Type
optionalTypeConverters
IDeserialisationTypeConverter[]