Welcome to mirror list, hosted at ThFree Co, Russian Federation.

StrictFormatterConverter.cs « Serialization « Runtime « System « UnitTestFramework « Tests « System.ComponentModel.Composition « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 29e68d753b30d6c343c1ffb334168084b73ee4c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// -----------------------------------------------------------------------
#if !SILVERLIGHT

using System;

namespace System.Runtime.Serialization
{
    /// <summary>
    ///     Represents an <see cref="IFormatterConverter"/> where no conversion is actually performed.
    /// </summary>
    public class StrictFormatterConverter : IFormatterConverter
    {
        public object Convert(object value, TypeCode typeCode)
        {
            return value;
        }

        public object Convert(object value, Type type)
        {
            return value;
        }

        public bool ToBoolean(object value)
        {
            return (bool)value;
        }

        public byte ToByte(object value)
        {
            return (byte)value;
        }

        public char ToChar(object value)
        {
            return (char)value;
        }

        public DateTime ToDateTime(object value)
        {
            return (DateTime)value;
        }

        public decimal ToDecimal(object value)
        {
            return (decimal)value;
        }

        public double ToDouble(object value)
        {
            return (double)value;
        }

        public short ToInt16(object value)
        {
            return (short)value;
        }

        public int ToInt32(object value)
        {
            return (int)value;
        }

        public long ToInt64(object value)
        {
            return (long)value;
        }

        [CLSCompliant(false)]
        public sbyte ToSByte(object value)
        {
            return (sbyte)value;
        }

        public float ToSingle(object value)
        {
            return (float)value;
        }

        public string ToString(object value)
        {
            return (string)value;
        }

        [CLSCompliant(false)]
        public ushort ToUInt16(object value)
        {
            return (ushort)value;
        }

        [CLSCompliant(false)]
        public uint ToUInt32(object value)
        {
            return (uint)value;
        }

        [CLSCompliant(false)]
        public ulong ToUInt64(object value)
        {
            return (ulong)value;
        }
    }
}

#endif // !SILVERLIGHT