summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/DBNull.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/DBNull.cs')
-rw-r--r--src/mscorlib/src/System/DBNull.cs121
1 files changed, 121 insertions, 0 deletions
diff --git a/src/mscorlib/src/System/DBNull.cs b/src/mscorlib/src/System/DBNull.cs
new file mode 100644
index 0000000000..27ba8cfe13
--- /dev/null
+++ b/src/mscorlib/src/System/DBNull.cs
@@ -0,0 +1,121 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+////////////////////////////////////////////////////////////////////////////////
+// Void
+// This class represents a Missing Variant
+////////////////////////////////////////////////////////////////////////////////
+namespace System {
+
+ using System;
+ using System.Runtime.Remoting;
+ using System.Runtime.Serialization;
+ using System.Security.Permissions;
+[System.Runtime.InteropServices.ComVisible(true)]
+ [Serializable]
+ public sealed class DBNull : ISerializable, IConvertible {
+
+ //Package private constructor
+ private DBNull(){
+ }
+
+ private DBNull(SerializationInfo info, StreamingContext context) {
+ throw new NotSupportedException(Environment.GetResourceString("NotSupported_DBNullSerial"));
+ }
+
+ public static readonly DBNull Value = new DBNull();
+
+ [System.Security.SecurityCritical]
+ public void GetObjectData(SerializationInfo info, StreamingContext context) {
+ UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.NullUnity, null, null);
+ }
+
+ public override String ToString() {
+ return String.Empty;
+ }
+
+ public String ToString(IFormatProvider provider) {
+ return String.Empty;
+ }
+
+ public TypeCode GetTypeCode() {
+ return TypeCode.DBNull;
+ }
+
+ /// <internalonly/>
+ bool IConvertible.ToBoolean(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ char IConvertible.ToChar(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ sbyte IConvertible.ToSByte(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ byte IConvertible.ToByte(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ short IConvertible.ToInt16(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ ushort IConvertible.ToUInt16(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ int IConvertible.ToInt32(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ uint IConvertible.ToUInt32(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ long IConvertible.ToInt64(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ ulong IConvertible.ToUInt64(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ float IConvertible.ToSingle(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ double IConvertible.ToDouble(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ decimal IConvertible.ToDecimal(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ DateTime IConvertible.ToDateTime(IFormatProvider provider) {
+ throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
+ }
+
+ /// <internalonly/>
+ Object IConvertible.ToType(Type type, IFormatProvider provider) {
+ return Convert.DefaultToType((IConvertible)this, type, provider);
+ }
+ }
+}
+