public static Sha1Wire Convert(this Sha1 model) { Sha1Wire wire; var array = ArrayPool <byte> .Shared.Rent(Sha1.ByteLen); { model.CopyTo(array); wire = new Sha1Wire { Set = true, Data = Google.Protobuf.ByteString.CopyFrom(array, 0, Sha1.ByteLen) }; } ArrayPool <byte> .Shared.Return(array); return(wire); }
public static Sha1Wire Convert(this Sha1 model) { Sha1Wire wire; byte[] rented = ArrayPool <byte> .Shared.Rent(Sha1.ByteLength); { model.CopyTo(rented); // TODO: Perf wire = new Sha1Wire { Set = true, Data = Google.Protobuf.ByteString.CopyFrom(rented, 0, Sha1.ByteLength) }; } ArrayPool <byte> .Shared.Return(rented); return(wire); }