Skip to content

Commit 52c7149

Browse files
authored
Avoid tostring in SqlConnectionEncryptOptionConverter if we know value is a string (dotnet#4012)
1 parent 5d695b6 commit 52c7149

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionEncryptOptionConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public override bool CanConvertTo(ITypeDescriptorContext context, Type sourceTyp
3636
// Overrides the ConvertFrom method of TypeConverter.
3737
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
3838
{
39-
if (value is string)
39+
if (value is string s)
4040
{
41-
return SqlConnectionEncryptOption.Parse(value.ToString());
41+
return SqlConnectionEncryptOption.Parse(s);
4242
}
4343
throw ADP.ConvertFailed(value.GetType(), typeof(SqlConnectionEncryptOption), null);
4444
}

0 commit comments

Comments
 (0)