1 instantiation of DBNull
System.Private.CoreLib (1)
src\libraries\System.Private.CoreLib\src\System\DBNull.cs (1)
16
public static readonly DBNull Value = new
DBNull
();
332 references to DBNull
dotnet-svcutil-lib (13)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Mappings.cs (1)
49
get { return _defaultValue != null && _defaultValue !=
DBNull
.Value; }
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapReflectionImporter.cs (1)
766
if (a.SoapDefaultValue == null || a.SoapDefaultValue ==
DBNull
.Value) return null;
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCodeExporter.cs (3)
356
return
DBNull
.Value;
415
return
DBNull
.Value;
490
if (value ==
DBNull
.Value)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlReflectionImporter.cs (1)
2135
if (a.XmlDefaultValue == null || a.XmlDefaultValue ==
DBNull
.Value) return null;
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSchemaExporter.cs (1)
910
if (value == null || value ==
DBNull
.Value)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (2)
1637
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value;
1720
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value && mapping.TypeDesc.HasDefaultSupport;
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (4)
94
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value;
197
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value && mapping.TypeDesc.HasDefaultSupport;
2530
if (type == typeof(
DBNull
))
2532
FieldInfo DBNull_Value = typeof(
DBNull
).GetField("Value", CodeGenerator.StaticBindingFlags);
Microsoft.CodeAnalysis.Test.Utilities (1)
Platform\Custom\MetadataSignatureHelper.cs (1)
151
if (defaultValue !=
DBNull
.Value)
Microsoft.Data.Analysis (1)
DataFrame.IO.cs (1)
169
items[c] = row[c] ??
DBNull
.Value;
Microsoft.Extensions.AI.Abstractions (4)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.ReflectionHelpers.cs (2)
314
if (defaultValue ==
DBNull
.Value && parameterType != typeof(
DBNull
))
Utilities\AIJsonUtilities.Schema.cs (2)
457
if (defaultValue is null || (defaultValue ==
DBNull
.Value && parameterType != typeof(
DBNull
)))
Microsoft.Extensions.Caching.SqlServer (2)
SqlParameterCollectionExtensions.cs (2)
75
return parameters.AddWithValue(Columns.Names.SlidingExpirationInSeconds, SqlDbType.BigInt,
DBNull
.Value);
91
Columns.Names.AbsoluteExpiration, SqlDbType.DateTimeOffset,
DBNull
.Value);
Microsoft.VisualBasic.Core (4)
Microsoft\VisualBasic\CompilerServices\LateBinding.vb (1)
909
(TypeOf NewValue Is
DBNull
) OrElse
Microsoft\VisualBasic\CompilerServices\Symbols.vb (1)
225
Case TypeCode.DBNull : Return GetType(
DBNull
)
Microsoft\VisualBasic\CompilerServices\VB6InputFile.vb (1)
91
ParseInputString =
DBNull
.Value
Microsoft\VisualBasic\CompilerServices\VB6RandomFile.vb (1)
278
Value =
DBNull
.Value
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
145
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
DBNull
))]
netstandard (1)
netstandard.cs (1)
615
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
DBNull
))]
PresentationFramework (2)
System\Windows\Data\BindingExpression.cs (2)
1363
else if ((value ==
DBNull
.Value) && (Converter == null || UseDefaultValueConverter))
1880
value =
DBNull
.Value;
Shared (2)
JsonSchemaExporter\JsonSchemaExporter.ReflectionHelpers.cs (2)
314
if (defaultValue ==
DBNull
.Value && parameterType != typeof(
DBNull
))
System.Data.Common (160)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (1)
484
if ((null == value) || (
DBNull
.Value == value))
System.Data.Common.TypeForwards.cs (1)
4
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
DBNull
))]
System\Data\Common\DataStorage.cs (3)
69
typeof(
DBNull
),
131
: this(column, type, defaultValue,
DBNull
.Value, false, storageType)
530
return ((null == value) || (
DBNull
.Value == value) || IsObjectSqlNull(value));
System\Data\Common\ObjectStorage.cs (1)
31
: base(column, type, null,
DBNull
.Value, typeof(ICloneable).IsAssignableFrom(type), GetStorageType(type))
System\Data\Common\SQLConvert.cs (21)
15
if ((value ==
DBNull
.Value))
33
if (value ==
DBNull
.Value)
52
if (value ==
DBNull
.Value)
75
if (value ==
DBNull
.Value)
100
if (value ==
DBNull
.Value)
133
if (value ==
DBNull
.Value)
163
if (value ==
DBNull
.Value)
194
if (value ==
DBNull
.Value)
224
if (value ==
DBNull
.Value)
242
if ((value ==
DBNull
.Value) || (value == null))
260
if (value ==
DBNull
.Value)
278
if (value ==
DBNull
.Value)
296
if ((value ==
DBNull
.Value) || (value == null))
314
if (value ==
DBNull
.Value)
330
if (value ==
DBNull
.Value)
352
if ((
DBNull
.Value == value) || (null == value)) { return
DBNull
.Value; }
405
if ((
DBNull
.Value == value) || (null == value))
407
return
DBNull
.Value;
649
if ((
DBNull
.Value == value) || (null == value))
651
return
DBNull
.Value;
System\Data\Common\SQLTypes\SQLBytesStorage.cs (1)
80
if ((value ==
DBNull
.Value) || (value == null))
System\Data\Common\SQLTypes\SQLCharsStorage.cs (1)
82
if ((value ==
DBNull
.Value) || (value == null))
System\Data\Common\SqlUDTStorage.cs (2)
77
if (
DBNull
.Value == value)
109
if (
DBNull
.Value == value)
System\Data\DataColumn.cs (12)
38
internal object _defaultValue =
DBNull
.Value; // DefaultValue Converter
648
if (_defaultValue ==
DBNull
.Value && _implementsINullable)
681
object newDefaultValue = value ??
DBNull
.Value;
682
if (newDefaultValue !=
DBNull
.Value && DataType != typeof(object))
695
_defaultValueIsNull = ((newDefaultValue ==
DBNull
.Value) || (ImplementsINullable && DataStorage.IsObjectSqlNull(newDefaultValue))) ? true : false;
1432
if (dr[this] ==
DBNull
.Value)
1538
clone._defaultValueIsNull = ((_defaultValue ==
DBNull
.Value) || (clone.ImplementsINullable && DataStorage.IsObjectSqlNull(_defaultValue))) ? true : false;
1585
return kind == AggregateType.Count ? (object)0 :
DBNull
.Value;
1691
if (value != null && value !=
DBNull
.Value && ((string)value).Length > MaxLength)
1717
DataRow[] rows = index.GetRows(index.FindRecords(
DBNull
.Value));
1777
Debug.Assert(value != null && (value !=
DBNull
.Value), "Caller is responsible for checking on DBNull");
1785
Debug.Assert(value != null && (value !=
DBNull
.Value), "Caller is responsible for checking on DBNull");
System\Data\DataColumnPropertyDescriptor.cs (2)
57
return (dataRowView.GetColumnValue(Column) !=
DBNull
.Value);
72
dataRowView.SetColumnValue(Column,
DBNull
.Value); // no need to ccheck for the col type and set Sql...Null!
System\Data\DataRow.cs (9)
152
if ((
DBNull
.Value != value) && ((IChangeTracking)value).IsChanged)
326
proposed =
DBNull
.Value;
417
/// should be left as-is. <see cref="
DBNull
.Value" /> can be used to set the value to null.
497
proposed =
DBNull
.Value;
552
if (
DBNull
.Value != value)
1195
if (
DBNull
.Value != value)
1212
if (
DBNull
.Value != value)
1265
this[column] =
DBNull
.Value;
1360
parentKeyValues[0] =
DBNull
.Value;
System\Data\DataRowComparer.cs (4)
27
if (a is null || ReferenceEquals(a,
DBNull
.Value) ||
28
b is null || ReferenceEquals(b,
DBNull
.Value))
43
if (a is null || ReferenceEquals(a,
DBNull
.Value) ||
44
b is null || ReferenceEquals(b,
DBNull
.Value))
System\Data\DataRowExtensions.cs (6)
116
row[columnIndex] = (object?)value ??
DBNull
.Value;
128
row[columnName] = (object?)value ??
DBNull
.Value;
140
row[column] = (object?)value ??
DBNull
.Value;
174
if (value ==
DBNull
.Value)
185
if (value ==
DBNull
.Value)
205
=> value ==
DBNull
.Value ? default : new Nullable<TElem>((TElem)value);
System\Data\DataTable.cs (1)
3477
row[c] =
DBNull
.Value;
System\Data\DataTableReader.cs (1)
817
if (dc.DefaultValue !=
DBNull
.Value)
System\Data\DefaultValueTypeConverter.cs (2)
32
else if (value ==
DBNull
.Value)
52
return
DBNull
.Value;
System\Data\Filter\BinaryNode.cs (41)
117
if (val ==
DBNull
.Value)
319
else if ((vLeft ==
DBNull
.Value) || (vRight ==
DBNull
.Value))
321
return
DBNull
.Value;
340
vLeft = vRight =
DBNull
.Value;
344
object value =
DBNull
.Value;
862
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)) ||
863
(vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
864
return
DBNull
.Value;
868
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)) ||
869
(vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
870
return
DBNull
.Value;
874
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)) ||
875
(vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
876
return
DBNull
.Value;
880
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)) ||
881
(vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
882
return
DBNull
.Value;
886
if (((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft))) ||
887
((vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight))))
888
return
DBNull
.Value;
892
if (((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft))) ||
893
((vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight))))
894
return
DBNull
.Value;
899
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)))
907
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)))
921
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)))
922
return
DBNull
.Value;
948
if ((vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
949
return
DBNull
.Value;
977
if ((vLeft !=
DBNull
.Value) && (!DataStorage.IsObjectSqlNull(vLeft)))
994
if ((vRight ==
DBNull
.Value) || (DataStorage.IsObjectSqlNull(vRight)))
997
if ((vLeft ==
DBNull
.Value) || (DataStorage.IsObjectSqlNull(vLeft)))
1095
if ((vLeft ==
DBNull
.Value) || (left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)))
1096
return
DBNull
.Value;
1108
if ((vRight ==
DBNull
.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
1536
if ((vLeft ==
DBNull
.Value) || (_left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)))
1537
return
DBNull
.Value;
1548
if (vRight ==
DBNull
.Value || DataStorage.IsObjectSqlNull(vRight))
1549
return
DBNull
.Value;
1590
return
DBNull
.Value;
System\Data\Filter\ConstNode.cs (1)
24
_val =
DBNull
.Value;
System\Data\Filter\DataExpression.cs (2)
136
if (result !=
DBNull
.Value || StorageType.Uri < _storageType)
190
return
DBNull
.Value;
System\Data\Filter\FunctionNode.cs (12)
146
if ((argumentValues[i] ==
DBNull
.Value) || (typeof(object) == s_funcs[_info]._parameters[i]))
150
return
DBNull
.Value;
366
return
DBNull
.Value;
411
return
DBNull
.Value;
453
return
DBNull
.Value;
469
return
DBNull
.Value;
481
if (argumentValues[0] ==
DBNull
.Value)
483
return
DBNull
.Value;
533
if (argumentValues[0] ==
DBNull
.Value || argumentValues[1] ==
DBNull
.Value || argumentValues[2] ==
DBNull
.Value)
534
return
DBNull
.Value;
System\Data\Filter\LookupNode.cs (1)
100
return
DBNull
.Value;
System\Data\Filter\UnaryNode.cs (2)
53
return
DBNull
.Value;
119
value =
DBNull
.Value;
System\Data\Filter\ZeroOpNode.cs (2)
38
return
DBNull
.Value;
41
return
DBNull
.Value;
System\Data\ForeignKeyConstraint.cs (2)
316
proposedKey[i] =
DBNull
.Value;
456
proposedKey[i] =
DBNull
.Value;
System\Data\ProviderBase\SchemaMapping.cs (6)
333
_ =>
DBNull
.Value,
1153
if (
DBNull
.Value != value)
1163
if (
DBNull
.Value != value)
1173
if (
DBNull
.Value != value)
1183
if (
DBNull
.Value != value)
1193
if (
DBNull
.Value != value)
System\Data\Select.cs (4)
657
if ((vLeft ==
DBNull
.Value) || (expr._left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft)))
659
if ((vRight ==
DBNull
.Value) || (expr._right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight)))
705
case Operators.Is: c = (vLeft ==
DBNull
.Value ? 0 : -1); break;
706
case Operators.IsNot: c = (vLeft !=
DBNull
.Value ? 0 : 1); break;
System\Data\XmlDataLoader.cs (8)
390
row[column] =
DBNull
.Value;
424
row[c] =
DBNull
.Value;
478
row[c] =
DBNull
.Value;
834
foundColumns[i] =
DBNull
.Value; // Assign DBNull if possible
1071
c[row._tempRecord] = foundColumns[i] ??
DBNull
.Value;
1102
foundColumns[i] =
DBNull
.Value; // Assign DBNull if possible
1194
columnValue =
DBNull
.Value; // change to DBNull;
1348
foundColumns[column.Ordinal] =
DBNull
.Value;
System\Data\XMLDiffLoader.cs (1)
324
col[record] =
DBNull
.Value;
System\Data\xmlsaver.cs (5)
2602
if ((columnValue !=
DBNull
.Value) && (!col.ImplementsINullable || !DataStorage.IsObjectSqlNull(columnValue)))
2978
if ((value !=
DBNull
.Value) && (!col.ImplementsINullable || !DataStorage.IsObjectSqlNull(value)))
2992
if ((value !=
DBNull
.Value) && (!col.ImplementsINullable || !DataStorage.IsObjectSqlNull(value)))
3008
if (((value ==
DBNull
.Value) || (col.ImplementsINullable && DataStorage.IsObjectSqlNull(value))) && (col.ColumnMapping == MappingType.SimpleContent))
3012
if (((value !=
DBNull
.Value) && (!col.ImplementsINullable || !DataStorage.IsObjectSqlNull(value))) && (col._columnMapping != MappingType.Attribute))
System\Xml\XmlDataDocument.cs (4)
2383
row[col] =
DBNull
.Value;
2396
Debug.Assert(oVal != null && !(oVal is
DBNull
));
2476
row[column] =
DBNull
.Value;
2512
row[c] =
DBNull
.Value;
System\Xml\XPathNodePointer.cs (1)
410
if (colVal ==
DBNull
.Value)
System.Data.Odbc (18)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (1)
484
if ((null == value) || (
DBNull
.Value == value))
src\libraries\Common\src\System\Data\ProviderBase\DbMetaDataFactory.cs (3)
141
restrictionParameter.Value =
DBNull
.Value;
517
if (version !=
DBNull
.Value)
536
if (version !=
DBNull
.Value)
System\Data\Odbc\OdbcCommandBuilder.cs (2)
87
if (
DBNull
.Value != bvalue)
94
if (
DBNull
.Value != bvalue)
System\Data\Odbc\OdbcDataReader.cs (1)
1790
_dataCache![i] =
DBNull
.Value;
System\Data\Odbc\OdbcMetaDataFactory.cs (10)
139
if (odbcSource !=
DBNull
.Value)
154
return
DBNull
.Value;
341
if ((getTypeInfoValues[indexAUTO_UNIQUE_VALUE] ==
DBNull
.Value) ||
354
if (getTypeInfoValues[indexNULLABLE] !=
DBNull
.Value)
368
dataTypesRow[isNullableColumn] =
DBNull
.Value;
373
if (
DBNull
.Value != getTypeInfoValues[indexSEARCHABLE])
404
if (getTypeInfoValues[indexMAXIMUM_SCALE] !=
DBNull
.Value)
409
if (getTypeInfoValues[indexMINIMUM_SCALE] !=
DBNull
.Value)
414
if (getTypeInfoValues[indexLITERAL_PREFIX] !=
DBNull
.Value)
419
if (getTypeInfoValues[indexLITERAL_SUFFIX] !=
DBNull
.Value)
System\Data\Odbc\OdbcParameter.cs (1)
959
Value =
DBNull
.Value;
System.Net.HttpListener (6)
src\libraries\Common\src\System\Net\LazyAsyncResult.cs (6)
63
_result =
DBNull
.Value;
250
return _result ==
DBNull
.Value ? null : _result;
261
Debug.Assert(value !=
DBNull
.Value, "Result can't be set to DBNull - it's a special internal value.");
300
if (result ==
DBNull
.Value)
314
if (_result ==
DBNull
.Value)
477
while (_result ==
DBNull
.Value)
System.Net.Mail (6)
src\libraries\Common\src\System\Net\LazyAsyncResult.cs (6)
63
_result =
DBNull
.Value;
250
return _result ==
DBNull
.Value ? null : _result;
261
Debug.Assert(value !=
DBNull
.Value, "Result can't be set to DBNull - it's a special internal value.");
300
if (result ==
DBNull
.Value)
314
if (_result ==
DBNull
.Value)
477
while (_result ==
DBNull
.Value)
System.Net.Requests (6)
src\libraries\Common\src\System\Net\LazyAsyncResult.cs (6)
63
_result =
DBNull
.Value;
250
return _result ==
DBNull
.Value ? null : _result;
261
Debug.Assert(value !=
DBNull
.Value, "Result can't be set to DBNull - it's a special internal value.");
300
if (result ==
DBNull
.Value)
314
if (_result ==
DBNull
.Value)
477
while (_result ==
DBNull
.Value)
System.Private.CoreLib (23)
src\libraries\System.Private.CoreLib\src\System\Convert.cs (3)
90
public static readonly object DBNull = System.
DBNull
.Value;
111
if (value == System.
DBNull
.Value) return true;
214
if (ReferenceEquals(targetType, typeof(
DBNull
)))
src\libraries\System.Private.CoreLib\src\System\DBNull.cs (1)
16
public static readonly
DBNull
Value = new DBNull();
src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (2)
133
if (par[j].DefaultValue ==
DBNull
.Value)
140
if (par[j].DefaultValue ==
DBNull
.Value)
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBase.cs (1)
144
if (paramInfo.DefaultValue ==
DBNull
.Value)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ComVariant.cs (3)
261
if (typeof(T) == typeof(
DBNull
))
450
if (typeof(T) == typeof(
DBNull
))
453
return (T)(object)
DBNull
.Value;
src\libraries\System.Private.CoreLib\src\System\Type.cs (1)
541
else if (underlyingType == typeof(
DBNull
))
src\libraries\System.Private.CoreLib\src\System\UnitySerializationHolder.cs (1)
56
return
DBNull
.Value;
src\System\Reflection\MdConstant.cs (3)
29
return
DBNull
.Value;
86
return
DBNull
.Value;
110
CorElementType.ELEMENT_TYPE_VOID =>
DBNull
.Value,
src\System\Reflection\MdFieldInfo.cs (1)
96
if (value ==
DBNull
.Value)
src\System\Reflection\RuntimeParameterInfo.cs (6)
316
return
DBNull
.Value;
329
return
DBNull
.Value;
339
defaultValue =
DBNull
.Value;
351
if (defaultValue ==
DBNull
.Value)
362
if (defaultValue ==
DBNull
.Value)
414
return
DBNull
.Value;
src\System\Reflection\RuntimePropertyInfo.cs (1)
217
if (defaultValue ==
DBNull
.Value)
System.Private.DataContractSerialization (2)
System\Runtime\Serialization\Globals.cs (1)
318
s_typeOfDBNull ??= typeof(
DBNull
);
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (1)
288
private static FieldInfo GetDBNullValueField() => typeof(
DBNull
).GetField("Value")!;
System.Private.Xml (14)
System\Xml\Serialization\Mappings.cs (1)
51
get { return _defaultValue != null && _defaultValue !=
DBNull
.Value; }
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (1)
868
else if ((element.Default != null && element.Default !=
DBNull
.Value && element.Mapping.TypeDesc!.IsValueType)
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (2)
554
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value && mapping.TypeDesc!.HasDefaultSupport;
1004
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value && mapping.TypeDesc!.HasDefaultSupport;
System\Xml\Serialization\SoapReflectionImporter.cs (1)
741
if (a.SoapDefaultValue == null || a.SoapDefaultValue ==
DBNull
.Value) return null;
System\Xml\Serialization\XmlReflectionImporter.cs (1)
2150
if (a.XmlDefaultValue == null || a.XmlDefaultValue ==
DBNull
.Value) return null;
System\Xml\Serialization\XmlSchemaExporter.cs (1)
869
if (value == null || value ==
DBNull
.Value)
System\Xml\Serialization\XmlSerializationReader.cs (1)
4664
if (element.Default != null && element.Default !=
DBNull
.Value && element.Mapping.TypeDesc!.IsValueType)
System\Xml\Serialization\XmlSerializationReaderILGen.cs (1)
3020
if (element.Default != null && element.Default !=
DBNull
.Value && element.Mapping.TypeDesc!.IsValueType)
System\Xml\Serialization\XmlSerializationWriter.cs (2)
2365
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value;
2449
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value && mapping.TypeDesc!.HasDefaultSupport;
System\Xml\Serialization\XmlSerializationWriterILGen.cs (3)
96
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value;
194
bool hasDefault = defaultValue != null && defaultValue !=
DBNull
.Value && mapping.TypeDesc!.HasDefaultSupport;
2381
if (type == typeof(
DBNull
))
System.Reflection.Emit (8)
System\Reflection\Emit\FieldBuilderImpl.cs (1)
25
internal object? _defaultValue =
DBNull
.Value;
System\Reflection\Emit\ModuleBuilderImpl.cs (3)
295
if (property._defaultValue !=
DBNull
.Value)
397
if (parameter._defaultValue !=
DBNull
.Value)
652
if (field.Attributes.HasFlag(FieldAttributes.HasDefault) && field._defaultValue !=
DBNull
.Value)
System\Reflection\Emit\ParameterBuilderImpl.cs (2)
17
internal object? _defaultValue =
DBNull
.Value;
87
public override bool HasDefaultValue => _pb._defaultValue !=
DBNull
.Value;
System\Reflection\Emit\PropertyBuilderImpl.cs (2)
27
internal object? _defaultValue =
DBNull
.Value;
139
public override object? GetConstantValue() => _defaultValue ==
DBNull
.Value ? null : _defaultValue;
System.Reflection.MetadataLoadContext (1)
System\Reflection\TypeLoading\Parameters\Ecma\EcmaFatMethodParameter.cs (1)
48
return IsOptional ? (object)Missing.Value : (object)
DBNull
.Value;
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
127
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
DBNull
))]
System.Runtime.InteropServices (2)
System\Runtime\InteropServices\Marshalling\ComVariantMarshaller.cs (2)
76
case
DBNull
:
130
return
DBNull
.Value;
System.Text.Json (2)
src\libraries\System.Text.Json\Common\ReflectionExtensions.cs (2)
299
if (defaultValue ==
DBNull
.Value && parameterType != typeof(
DBNull
))
System.Windows.Forms (27)
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
209
return string.IsNullOrEmpty(Value?.ToString()?.Trim(' ')) || Value is
DBNull
System\Windows\Forms\Controls\DataGridView\DataGridViewCellStyle.cs (3)
127
:
DBNull
.Value;
137
Properties.AddOrRemoveValue(s_propDataSourceNullValue, value,
DBNull
.Value);
215
return value ==
DBNull
.Value;
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (1)
498
if (string.IsNullOrEmpty(Value?.ToString()?.Trim(' ')) || Value is
DBNull
)
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (7)
815
return string.IsNullOrEmpty(Value?.ToString()?.Trim(' ')) || Value is
DBNull
913
if (value is null || ((ValueType is not null && !ValueType.IsAssignableFrom(value.GetType())) && value !=
DBNull
.Value))
957
if (value ==
DBNull
.Value)
959
displayValue =
DBNull
.Value;
997
&& value !=
DBNull
.Value
2405
if (originalValue ==
DBNull
.Value)
2407
value =
DBNull
.Value;
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
482
return string.IsNullOrEmpty(Value?.ToString()?.Trim(' ')) || Value is
DBNull
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (1)
318
return string.IsNullOrEmpty(Value?.ToString()?.Trim(' ')) || Value is
DBNull
System\Windows\Forms\Controls\ListControl\ListControl.cs (1)
563
DBNull
.Value);
System\Windows\Forms\DataBinding\Binding.cs (3)
650
if (!(cevent.Value is
DBNull
) && cevent.Value is not null && cevent.DesiredType is not null && !cevent.DesiredType.IsInstanceOfType(cevent.Value) && (cevent.Value is IConvertible))
663
if (!(cevent.Value is
DBNull
) && cevent.DesiredType is not null && !cevent.DesiredType.IsInstanceOfType(cevent.Value) && (cevent.Value is IConvertible))
712
if (e.Value is not null && (e.Value.GetType().IsSubclassOf(type) || e.Value.GetType() == type || e.Value is
DBNull
))
System\Windows\Forms\Internal\Formatter.cs (9)
18
private static readonly object s_defaultDataSourceNullValue =
DBNull
.Value;
49
value =
DBNull
.Value;
96
if (value ==
DBNull
.Value || value is null)
264
return result ==
DBNull
.Value ? NullData(oldTargetType, dataSourceNullValue) : result;
289
if (EqualsFormattedNullValue(value, formattedNullValue, formatInfo) || value ==
DBNull
.Value)
291
return
DBNull
.Value;
323
return
DBNull
.Value;
495
value ==
DBNull
.Value ||
508
if (dataSourceNullValue is null || dataSourceNullValue ==
DBNull
.Value)
System.Windows.Forms.Tests (25)
System\Windows\Forms\BindingTests.cs (13)
33
Assert.Same(
DBNull
.Value, binding.DataSourceNullValue);
62
Assert.Same(
DBNull
.Value, binding.DataSourceNullValue);
91
Assert.Same(
DBNull
.Value, binding.DataSourceNullValue);
104
yield return new object[] { string.Empty, new(), string.Empty, true, DataSourceUpdateMode.OnValidation - 1,
DBNull
.Value };
120
Assert.Same(
DBNull
.Value, binding.DataSourceNullValue);
133
yield return new object[] { string.Empty, new(), string.Empty, true, DataSourceUpdateMode.OnValidation - 1,
DBNull
.Value, string.Empty };
149
Assert.Same(
DBNull
.Value, binding.DataSourceNullValue);
162
yield return new object[] { string.Empty, new(), string.Empty, true, DataSourceUpdateMode.OnValidation - 1,
DBNull
.Value, string.Empty, CultureInfo.CurrentCulture };
178
Assert.Same(
DBNull
.Value, binding.DataSourceNullValue);
192
yield return new object[] {
DBNull
.Value };
301
yield return new object[] {
DBNull
.Value };
448
yield return new object[] { false, new ConvertEventArgs(
DBNull
.Value, typeof(int)),
DBNull
.Value };
System\Windows\Forms\DataGridViewCellStyleTests.cs (8)
22
Assert.Equal(
DBNull
.Value, style.DataSourceNullValue);
88
Assert.Equal(
DBNull
.Value, style.DataSourceNullValue);
161
yield return new object[] {
DBNull
.Value, true };
254
style.DataSourceNullValue =
DBNull
.Value;
255
Assert.Equal(
DBNull
.Value, style.DataSourceNullValue);
383
yield return new object[] {
DBNull
.Value, false };
756
Assert.Equal(
DBNull
.Value, style.DataSourceNullValue);
822
Assert.Equal(
DBNull
.Value, style.DataSourceNullValue);
System\Windows\Forms\DataGridViewCellTests.cs (4)
6095
yield return new object[] { typeof(object), typeof(
DBNull
),
DBNull
.Value, new DataGridViewCellStyle(), null, null, null };
6102
yield return new object[] { typeof(int), typeof(int), 1, new DataGridViewCellStyle { NullValue = 1 }, null, null,
DBNull
.Value };
6134
yield return new object[] { typeof(bool), typeof(CheckState), CheckState.Indeterminate, new DataGridViewCellStyle(), null, null,
DBNull
.Value };