Skip to content

Commit

Permalink
Perf | avoid copying of an array for SqlBinary in TdsParser (dotnet#2308
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 f1282f4 commit e269e15
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -5957,7 +5957,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 e269e15

Please sign in to comment.