2020-10-25 19:00:51 +08:00
|
|
|
|
using System.Runtime.CompilerServices;
|
2020-07-15 20:02:39 +08:00
|
|
|
|
|
|
|
|
|
namespace AntDesign.core.Extensions
|
|
|
|
|
{
|
|
|
|
|
public static class DataConvertionExtensions
|
|
|
|
|
{
|
2020-10-25 19:00:51 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Converts the generic type TFrom to the specified TTo type
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="TFrom"></typeparam>
|
|
|
|
|
/// <typeparam name="TTo"></typeparam>
|
|
|
|
|
/// <param name="fromValue"></param>
|
|
|
|
|
/// <returns></returns>
|
2020-07-15 20:02:39 +08:00
|
|
|
|
public static TTo Convert<TFrom, TTo>(TFrom fromValue)
|
|
|
|
|
{
|
2020-10-25 19:00:51 +08:00
|
|
|
|
return Unsafe.As<TFrom, TTo>(ref fromValue);
|
2020-07-15 20:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|