/// <summary> /// Serialized a fixed object. The default implementation requires that the value is /// a GenericFixed object with an identical schema as es. /// </summary> /// <param name="es">The schema for serialization</param> /// <param name="value">The value to be serialized</param> /// <param name="encoder">The encoder for serialization</param> protected virtual void WriteFixed(FixedSchema es, object value, Encoder encoder) { if (value == null || !(value is GenericFixed) || !(value as GenericFixed).Schema.Equals(es)) { throw TypeMismatch(value, "fixed", "GenericFixed"); } GenericFixed ba = (GenericFixed)value; encoder.WriteFixed(ba.Value); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj != null && obj is GenericFixed) { GenericFixed that = obj as GenericFixed; if (that.Schema.Equals(this.Schema)) { for (int i = 0; i < value.Length; i++) { if (this.value[i] != that.value[i]) { return(false); } } return(true); } } return(false); }