Reputation: 213
I have in my Visual Studio 2008 .NET C# project one property observed and debugger shows open and immediately closed curly brackets "{}". I believe it is uninitialized (I)List, but why it does not shows "null" or "unitialized". What does "{}" it means ?
br, Milan.
Upvotes: 5
Views: 1418
Reputation: 1178
This can indicate a value of System.DBNull
You can check against it like this:
foreach (var val in datarow.ItemArray)
{
if (val == DBNull.Value)
{
var item = val;
}
}
Upvotes: 2
Reputation: 22433
If you want to change the value shown in the debugger you can control it with the DebuggerDisplayAttribute. You could also override the .ToString()
method instead. But this could affect other areas of your applications.
Upvotes: 1
Reputation: 754595
The most likely reason is that the type of the value in question overrides the .ToString()
method and returns an empty string. This will cause the display to be {} as the C# EE wraps the return of .ToString inside of {}'s
Upvotes: 5