public RailStateDataSerializer(RailState instance) { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } state = instance; foreach (PropertyInfo prop in state .GetType() .GetProperties( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { if (Attribute.IsDefined(prop, typeof(MutableAttribute))) { mutable.Add(RailSynchronizedFactory.Create(state, prop)); } else if (Attribute.IsDefined(prop, typeof(ImmutableAttribute))) { immutable.Add(RailSynchronizedFactory.Create(state, prop)); } else if (Attribute.IsDefined(prop, typeof(ControllerAttribute))) { controller.Add(RailSynchronizedFactory.Create(state, prop)); } } }
public RailCommandDataSerializer(RailCommand instance) { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } command = instance; foreach (PropertyInfo prop in instance .GetType() .GetProperties( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { if (Attribute.IsDefined(prop, typeof(CommandDataAttribute))) { members.Add(RailSynchronizedFactory.Create(instance, prop)); } } }