Files
GX.O3.WMS/APP.O3/Shared/Extensions/Int16Ext.cs
T

34 lines
827 B
C#
Executable File

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Opsoft.NetCore.O3App.Shared
{
public static class Int16Ext
{
public static TOut ToEnum<TOut>( this short value )
{
var outputType = typeof( TOut );
if ( outputType.IsEnum )
{
if ( outputType.IsEnumDefined( value ) )
{
var obj = System.Enum.ToObject( outputType, value );
if ( obj != null )
{
return ( TOut )obj;
}
}
}
return default( TOut );
}
public static System.Int32 ToInt32( this short value )
{
return Convert.ToInt32( value );
}
}
}