mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 17:31:42 +08:00
b6f21b5cf7
* 使用UnSafe替换表达树的编译实现,提高性能 * fix: translate the comments Co-authored-by: ElderJames <shunjiey@hotmail.com>
20 lines
572 B
C#
20 lines
572 B
C#
using System.Runtime.CompilerServices;
|
|
|
|
namespace AntDesign.core.Extensions
|
|
{
|
|
public static class DataConvertionExtensions
|
|
{
|
|
/// <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>
|
|
public static TTo Convert<TFrom, TTo>(TFrom fromValue)
|
|
{
|
|
return Unsafe.As<TFrom, TTo>(ref fromValue);
|
|
}
|
|
}
|
|
}
|