|
14 | 14 | */
|
15 | 15 |
|
16 | 16 | using System;
|
| 17 | +using MongoDB.Bson.Serialization.Attributes; |
17 | 18 |
|
18 | 19 | namespace MongoDB.Bson.Serialization.Options
|
19 | 20 | {
|
@@ -56,70 +57,6 @@ public bool AllowTruncation
|
56 | 57 | }
|
57 | 58 |
|
58 | 59 | // public methods
|
59 |
| - /// <summary> |
60 |
| - /// Converts an Int32 to a byte. |
61 |
| - /// </summary> |
62 |
| - /// <param name="value">An Int32.</param> |
63 |
| - /// <returns>A byte.</returns> |
64 |
| - public byte ToByte(int value) |
65 |
| - { |
66 |
| - if (value < byte.MinValue || value > byte.MaxValue) |
67 |
| - { |
68 |
| - if (!_allowOverflow) { throw new OverflowException(); } |
69 |
| - return unchecked((byte)value); |
70 |
| - } |
71 |
| - |
72 |
| - return checked((byte)value); |
73 |
| - } |
74 |
| - |
75 |
| - /// <summary> |
76 |
| - /// Converts an Int64 to a byte. |
77 |
| - /// </summary> |
78 |
| - /// <param name="value">An Int64.</param> |
79 |
| - /// <returns>A byte.</returns> |
80 |
| - public byte ToByte(long value) |
81 |
| - { |
82 |
| - if (value < byte.MinValue || value > byte.MaxValue) |
83 |
| - { |
84 |
| - if (!_allowOverflow) { throw new OverflowException(); } |
85 |
| - return unchecked((byte)value); |
86 |
| - } |
87 |
| - |
88 |
| - return checked((byte)value); |
89 |
| - } |
90 |
| - |
91 |
| - /// <summary> |
92 |
| - /// Converts an Int32 to a char. |
93 |
| - /// </summary> |
94 |
| - /// <param name="value">An Int32.</param> |
95 |
| - /// <returns>A char.</returns> |
96 |
| - public char ToChar(int value) |
97 |
| - { |
98 |
| - if (value < char.MinValue || value > char.MaxValue) |
99 |
| - { |
100 |
| - if (!_allowOverflow) { throw new OverflowException(); } |
101 |
| - return unchecked((char)value); |
102 |
| - } |
103 |
| - |
104 |
| - return checked((char)value); |
105 |
| - } |
106 |
| - |
107 |
| - /// <summary> |
108 |
| - /// Converts an Int64 to a char. |
109 |
| - /// </summary> |
110 |
| - /// <param name="value">An Int64.</param> |
111 |
| - /// <returns>A char.</returns> |
112 |
| - public char ToChar(long value) |
113 |
| - { |
114 |
| - if (value < char.MinValue || value > char.MaxValue) |
115 |
| - { |
116 |
| - if (!_allowOverflow) { throw new OverflowException(); } |
117 |
| - return unchecked((char)value); |
118 |
| - } |
119 |
| - |
120 |
| - return checked((char)value); |
121 |
| - } |
122 |
| - |
123 | 60 | /// <summary>
|
124 | 61 | /// Converts a Decimal128 to a Decimal.
|
125 | 62 | /// </summary>
|
@@ -548,26 +485,6 @@ public short ToInt16(long value)
|
548 | 485 | return (short)value;
|
549 | 486 | }
|
550 | 487 |
|
551 |
| - /// <summary> |
552 |
| - /// Converts a byte to an Int32. |
553 |
| - /// </summary> |
554 |
| - /// <param name="value">A byte.</param> |
555 |
| - /// <returns>An Int32.</returns> |
556 |
| - public int ToInt32(byte value) |
557 |
| - { |
558 |
| - return (int)value; |
559 |
| - } |
560 |
| - |
561 |
| - /// <summary> |
562 |
| - /// Converts a char to an Int32. |
563 |
| - /// </summary> |
564 |
| - /// <param name="value">A char.</param> |
565 |
| - /// <returns>An Int32.</returns> |
566 |
| - public int ToInt32(char value) |
567 |
| - { |
568 |
| - return (int)value; |
569 |
| - } |
570 |
| - |
571 | 488 | /// <summary>
|
572 | 489 | /// Converts a Decimal to an Int32.
|
573 | 490 | /// </summary>
|
@@ -681,17 +598,6 @@ public int ToInt32(long value)
|
681 | 598 | return (int)value;
|
682 | 599 | }
|
683 | 600 |
|
684 |
| - /// <summary> |
685 |
| - /// Converts an sbyte to an Int32. |
686 |
| - /// </summary> |
687 |
| - /// <param name="value">An sbyte.</param> |
688 |
| - /// <returns>An Int32.</returns> |
689 |
| - [CLSCompliant(false)] |
690 |
| - public int ToInt32(sbyte value) |
691 |
| - { |
692 |
| - return (int)value; |
693 |
| - } |
694 |
| - |
695 | 601 | /// <summary>
|
696 | 602 | /// Converts an Int16 to an Int32.
|
697 | 603 | /// </summary>
|
@@ -743,26 +649,6 @@ public int ToInt32(ushort value)
|
743 | 649 | return value;
|
744 | 650 | }
|
745 | 651 |
|
746 |
| - /// <summary> |
747 |
| - /// Converts a byte to an Int64. |
748 |
| - /// </summary> |
749 |
| - /// <param name="value">A byte.</param> |
750 |
| - /// <returns>An Int64.</returns> |
751 |
| - public long ToInt64(byte value) |
752 |
| - { |
753 |
| - return (long)value; |
754 |
| - } |
755 |
| - |
756 |
| - /// <summary> |
757 |
| - /// Converts a char to an Int64. |
758 |
| - /// </summary> |
759 |
| - /// <param name="value">A char.</param> |
760 |
| - /// <returns>An Int64.</returns> |
761 |
| - public long ToInt64(char value) |
762 |
| - { |
763 |
| - return (long)value; |
764 |
| - } |
765 |
| - |
766 | 652 | /// <summary>
|
767 | 653 | /// Converts a Decimal to an Int64.
|
768 | 654 | /// </summary>
|
@@ -872,17 +758,6 @@ public long ToInt64(long value)
|
872 | 758 | return value;
|
873 | 759 | }
|
874 | 760 |
|
875 |
| - /// <summary> |
876 |
| - /// Converts an sbyte to an Int64. |
877 |
| - /// </summary> |
878 |
| - /// <param name="value">An sbyte.</param> |
879 |
| - /// <returns>An Int64.</returns> |
880 |
| - [CLSCompliant(false)] |
881 |
| - public long ToInt64(sbyte value) |
882 |
| - { |
883 |
| - return (long)value; |
884 |
| - } |
885 |
| - |
886 | 761 | /// <summary>
|
887 | 762 | /// Converts an Int16 to an Int64.
|
888 | 763 | /// </summary>
|
@@ -930,40 +805,6 @@ public long ToInt64(ushort value)
|
930 | 805 | return value;
|
931 | 806 | }
|
932 | 807 |
|
933 |
| - /// <summary> |
934 |
| - /// Converts an Int32 to an sbyte. |
935 |
| - /// </summary> |
936 |
| - /// <param name="value">An Int32.</param> |
937 |
| - /// <returns>An sbyte.</returns> |
938 |
| - [CLSCompliant(false)] |
939 |
| - public sbyte ToSByte(int value) |
940 |
| - { |
941 |
| - if (value < sbyte.MinValue || value > sbyte.MaxValue) |
942 |
| - { |
943 |
| - if (!_allowOverflow) { throw new OverflowException(); } |
944 |
| - return unchecked((sbyte)value); |
945 |
| - } |
946 |
| - |
947 |
| - return checked((sbyte)value); |
948 |
| - } |
949 |
| - |
950 |
| - /// <summary> |
951 |
| - /// Converts an Int64 to an sbyte. |
952 |
| - /// </summary> |
953 |
| - /// <param name="value">An Int64.</param> |
954 |
| - /// <returns>An sbyte.</returns> |
955 |
| - [CLSCompliant(false)] |
956 |
| - public sbyte ToSByte(long value) |
957 |
| - { |
958 |
| - if (value < sbyte.MinValue || value > sbyte.MaxValue) |
959 |
| - { |
960 |
| - if (!_allowOverflow) { throw new OverflowException(); } |
961 |
| - return unchecked((sbyte)value); |
962 |
| - } |
963 |
| - |
964 |
| - return checked((sbyte)value); |
965 |
| - } |
966 |
| - |
967 | 808 | /// <summary>
|
968 | 809 | /// Converts a Decimal128 to a Single.
|
969 | 810 | /// </summary>
|
|
0 commit comments