/// <summary>
 ///   Compiles the dynamic method, returning a delegate that can be used to invoke it.
 /// </summary>
 /// <param name="objects">The known objects that can be serialized and deserialized.</param>
 internal T Compile <T>(ObjectTable objects = null)
 {
     _il.Emit(OpCodes.Ret);
     return((T)(object)_method.CreateDelegate(typeof(T), objects));
 }
Exemple #2
0
		/// <summary>
		///   Dynamically generates factory method for delegates that can be used to deserialize the state vector.
		/// </summary>
		/// <param name="objects">The objects whose data is stored in the state vector.</param>
		internal unsafe SerializationDelegate CreateDeserializer(ObjectTable objects)
		{
			var generator = new SerializationGenerator(methodName: "Deserialize");
			generator.GenerateDeserializationCode(Groups);
			return generator.Compile<SerializationDelegate>(objects);
		}
 /// <summary>
 ///   Compiles the dynamic method, returning a delegate that can be used to invoke it.
 /// </summary>
 /// <param name="objects">The known objects that can be serialized and deserialized.</param>
 internal Action Compile(ObjectTable objects = null)
 {
     _il.Emit(OpCodes.Ret);
     return((Action)_method.CreateDelegate(typeof(Action), objects));
 }
Exemple #4
0
		/// <summary>
		///   Dynamically generates a delegate that can be used to restrict state ranges.
		/// </summary>
		/// <param name="objects">The objects whose data is stored in the state vector.</param>
		internal Action CreateRangeRestrictor(ObjectTable objects)
		{
			var generator = new RangeRestrictionsGenerator(methodName: "RestrictRanges");
			generator.GenerateCode(Groups);
			return generator.Compile(objects);
		}