Skip to content

Commit

Permalink
Perf | avoid copying of an array for SqlBinary in TdsParser
Browse files Browse the repository at this point in the history
follow up changes for PR dotnet#1934
  • Loading branch information
wilbit committed Jan 19, 2024
1 parent 41416f5 commit 39b2f1a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5953,7 +5953,11 @@ internal bool DeserializeUnencryptedValue(SqlBuffer value, byte[] unencryptedByt
unencryptedBytes = bytes;
}

value.SqlBinary = new SqlBinary(unencryptedBytes); // doesn't copy the byte array
#if NET7_0_OR_GREATER
value.SqlBinary = SqlBinary.WrapBytes(unencryptedBytes);
#else
value.SqlBinary = SqlTypeWorkarounds.SqlBinaryCtor(unencryptedBytes, true); // doesn't copy the byte array
#endif
break;
}

Expand Down

0 comments on commit 39b2f1a

Please sign in to comment.