ReSharper marks ToString() as redundant, but it might be correct.

In the following code

string s = null;
Console.WriteLine(s.ToString());

.ToString() is marked as redundant, but removing it would actually change the functionality. This case is obviously simplistic, and there are better ways to check whether an object is null.

1
1 comment
Avatar
Permanently deleted user

I have an override on ToString: So yes, needs to be ignored

public override string ToString()
{
return JsonConvert.SerializeObject(this);
}

0

Please sign in to leave a comment.