/// <summary> /// Serialisiert das Objekt in den Byte Serializer /// </summary> /// <param name="value">Wert, der Serialisiert werden soll</param> /// <param name="serializer">Serializer, in den die Werte geschrieben werden</param> protected override void Serialize(TFor value, ByteSerializer serializer) { foreach (var propertyInfo in _properties) { _writeDelegates[propertyInfo.PropertyType](propertyInfo.GetValue(value), serializer); } }
/// <summary> /// Deserialisiert ein Objekt /// </summary> /// <param name="serializer">Serializer, dem das serialisierte Objekt zu entnehmen ist</param> /// <returns>Deserialisierte Instanz</returns> protected override TFor Deserialize(ByteSerializer serializer) { // => Instanz erzeugen var instance = (TFor)Activator.CreateInstance(typeof(TFor)); // => Deserialisieren foreach (var propertyInfo in _properties) { var value = _readDelegates[propertyInfo.PropertyType](serializer); propertyInfo.SetValue(instance, value); } return(instance); }