[Modify] Remove it
This commit is contained in:
parent
8ce5146185
commit
6f5e69eaf2
@ -1946,78 +1946,6 @@ namespace WebSocketSharp
|
||||
action (i);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the specified byte array to the specified type value.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// <para>
|
||||
/// A T converted from <paramref name="source"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The default value of T if not converted.
|
||||
/// </para>
|
||||
/// </returns>
|
||||
/// <param name="source">
|
||||
/// An array of <see cref="byte"/> to convert.
|
||||
/// </param>
|
||||
/// <param name="sourceOrder">
|
||||
/// <para>
|
||||
/// One of the <see cref="ByteOrder"/> enum values.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// It specifies the byte order of <paramref name="source"/>.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <typeparam name="T">
|
||||
/// <para>
|
||||
/// The type of the return.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <see cref="bool"/>, <see cref="char"/>, <see cref="double"/>,
|
||||
/// <see cref="float"/>, <see cref="int"/>, <see cref="long"/>,
|
||||
/// <see cref="short"/>, <see cref="uint"/>, <see cref="ulong"/>,
|
||||
/// or <see cref="ushort"/>.
|
||||
/// </para>
|
||||
/// </typeparam>
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// <paramref name="source"/> is <see langword="null"/>.
|
||||
/// </exception>
|
||||
[Obsolete ("This method will be removed.")]
|
||||
public static T To<T> (this byte[] source, ByteOrder sourceOrder)
|
||||
where T : struct
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException ("source");
|
||||
|
||||
if (source.Length == 0)
|
||||
return default (T);
|
||||
|
||||
var type = typeof (T);
|
||||
var val = source.ToHostOrder (sourceOrder);
|
||||
|
||||
return type == typeof (Boolean)
|
||||
? (T)(object) BitConverter.ToBoolean (val, 0)
|
||||
: type == typeof (Char)
|
||||
? (T)(object) BitConverter.ToChar (val, 0)
|
||||
: type == typeof (Double)
|
||||
? (T)(object) BitConverter.ToDouble (val, 0)
|
||||
: type == typeof (Int16)
|
||||
? (T)(object) BitConverter.ToInt16 (val, 0)
|
||||
: type == typeof (Int32)
|
||||
? (T)(object) BitConverter.ToInt32 (val, 0)
|
||||
: type == typeof (Int64)
|
||||
? (T)(object) BitConverter.ToInt64 (val, 0)
|
||||
: type == typeof (Single)
|
||||
? (T)(object) BitConverter.ToSingle (val, 0)
|
||||
: type == typeof (UInt16)
|
||||
? (T)(object) BitConverter.ToUInt16 (val, 0)
|
||||
: type == typeof (UInt32)
|
||||
? (T)(object) BitConverter.ToUInt32 (val, 0)
|
||||
: type == typeof (UInt64)
|
||||
? (T)(object) BitConverter.ToUInt64 (val, 0)
|
||||
: default (T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the specified value to a byte array.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user