Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DefaultValueTypeConverter.cs
Go to the documentation of this file.
1
using
System.ComponentModel
;
2
using
System.Globalization
;
3
4
namespace
System.Data
;
5
6
internal
sealed
class
DefaultValueTypeConverter
:
StringConverter
7
{
8
public
override
object
ConvertTo
(
ITypeDescriptorContext
context,
CultureInfo
culture
,
object
value
,
Type
destinationType)
9
{
10
if
(destinationType ==
null
)
11
{
12
throw
new
ArgumentNullException
(
"destinationType"
);
13
}
14
if
(destinationType == typeof(
string
))
15
{
16
if
(
value
==
null
)
17
{
18
return
"<null>"
;
19
}
20
if
(
value
==
DBNull
.
Value
)
21
{
22
return
"<DBNull>"
;
23
}
24
}
25
return
base.ConvertTo(context,
culture
,
value
, destinationType);
26
}
27
28
public
override
object
ConvertFrom
(
ITypeDescriptorContext
context,
CultureInfo
culture
,
object
value
)
29
{
30
if
(
value
!=
null
&&
value
.GetType() == typeof(
string
))
31
{
32
string
a = (
string
)
value
;
33
if
(
string
.Equals(a,
"<null>"
,
StringComparison
.OrdinalIgnoreCase))
34
{
35
return
null
;
36
}
37
if
(
string
.Equals(a,
"<DBNull>"
,
StringComparison
.OrdinalIgnoreCase))
38
{
39
return
DBNull
.
Value
;
40
}
41
}
42
return
base.ConvertFrom(context,
culture
,
value
);
43
}
44
}
System.ArgumentNullException
Definition
ArgumentNullException.cs:10
System.ComponentModel.StringConverter
Definition
StringConverter.cs:6
System.DBNull.Value
static readonly DBNull Value
Definition
DBNull.cs:8
System.DBNull
Definition
DBNull.cs:7
System.Data.DefaultValueTypeConverter.ConvertFrom
override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Definition
DefaultValueTypeConverter.cs:28
System.Data.DefaultValueTypeConverter.ConvertTo
override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
Definition
DefaultValueTypeConverter.cs:8
System.Data.DefaultValueTypeConverter
Definition
DefaultValueTypeConverter.cs:7
System.Globalization.CultureInfo
Definition
CultureInfo.cs:8
System.Type
Definition
Type.cs:14
string
System.ComponentModel.ITypeDescriptorContext
Definition
ITypeDescriptorContext.cs:4
System.ComponentModel
Definition
ColumnAttribute.cs:3
System.Data
Definition
ADP.cs:12
System.Globalization
Definition
Calendar.cs:1
System.ExceptionArgument.value
@ value
System.ExceptionArgument.culture
@ culture
System.StringComparison
StringComparison
Definition
StringComparison.cs:4
source
System.Data.Common
System.Data
DefaultValueTypeConverter.cs
Generated by
1.10.0