summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs')
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs121
1 files changed, 79 insertions, 42 deletions
diff --git a/src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs b/src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs
index 27f7ecf9d2..52e748db89 100644
--- a/src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs
+++ b/src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs
@@ -12,42 +12,53 @@
**
**
============================================================*/
-namespace System.Runtime.Serialization {
- using System;
- using System.Globalization;
- using System.Diagnostics.Contracts;
- internal class FormatterConverter : IFormatterConverter {
+using System;
+using System.Globalization;
+using System.Diagnostics.Contracts;
- public FormatterConverter() {
+namespace System.Runtime.Serialization
+{
+ internal class FormatterConverter : IFormatterConverter
+ {
+ public FormatterConverter()
+ {
}
- public Object Convert(Object value, Type type) {
- if (value==null) {
+ public Object Convert(Object value, Type type)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
}
- public Object Convert(Object value, TypeCode typeCode) {
- if (value==null) {
+ public Object Convert(Object value, TypeCode typeCode)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ChangeType(value, typeCode, CultureInfo.InvariantCulture);
}
- public bool ToBoolean(Object value) {
- if (value==null) {
+ public bool ToBoolean(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToBoolean(value, CultureInfo.InvariantCulture);
}
- public char ToChar(Object value) {
- if (value==null) {
+ public char ToChar(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
@@ -55,24 +66,30 @@ namespace System.Runtime.Serialization {
}
[CLSCompliant(false)]
- public sbyte ToSByte(Object value) {
- if (value==null) {
+ public sbyte ToSByte(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToSByte(value, CultureInfo.InvariantCulture);
}
- public byte ToByte(Object value) {
- if (value==null) {
+ public byte ToByte(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToByte(value, CultureInfo.InvariantCulture);
}
- public short ToInt16(Object value) {
- if (value==null) {
+ public short ToInt16(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
@@ -80,16 +97,20 @@ namespace System.Runtime.Serialization {
}
[CLSCompliant(false)]
- public ushort ToUInt16(Object value) {
- if (value==null) {
+ public ushort ToUInt16(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToUInt16(value, CultureInfo.InvariantCulture);
}
- public int ToInt32(Object value) {
- if (value==null) {
+ public int ToInt32(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
@@ -97,16 +118,20 @@ namespace System.Runtime.Serialization {
}
[CLSCompliant(false)]
- public uint ToUInt32(Object value) {
- if (value==null) {
+ public uint ToUInt32(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToUInt32(value, CultureInfo.InvariantCulture);
}
- public long ToInt64(Object value) {
- if (value==null) {
+ public long ToInt64(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
@@ -114,48 +139,60 @@ namespace System.Runtime.Serialization {
}
[CLSCompliant(false)]
- public ulong ToUInt64(Object value) {
- if (value==null) {
+ public ulong ToUInt64(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToUInt64(value, CultureInfo.InvariantCulture);
- }
+ }
- public float ToSingle(Object value) {
- if (value==null) {
+ public float ToSingle(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToSingle(value, CultureInfo.InvariantCulture);
}
- public double ToDouble(Object value) {
- if (value==null) {
+ public double ToDouble(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToDouble(value, CultureInfo.InvariantCulture);
}
- public Decimal ToDecimal(Object value) {
- if (value==null) {
+ public Decimal ToDecimal(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToDecimal(value, CultureInfo.InvariantCulture);
}
- public DateTime ToDateTime(Object value) {
- if (value==null) {
+ public DateTime ToDateTime(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
return System.Convert.ToDateTime(value, CultureInfo.InvariantCulture);
}
- public String ToString(Object value) {
- if (value==null) {
+ public String ToString(Object value)
+ {
+ if (value == null)
+ {
throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
@@ -163,4 +200,4 @@ namespace System.Runtime.Serialization {
}
}
}
-
+