2023-06-29 14:57:11 +08:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace BITKit
|
|
|
|
{
|
|
|
|
public static class MathO
|
|
|
|
{
|
2024-06-12 16:01:56 +08:00
|
|
|
public static T As<T>(this object self) where T : class
|
|
|
|
{
|
2024-06-12 16:49:42 +08:00
|
|
|
// {
|
|
|
|
// if (typeof(T) == typeof(object[]))
|
|
|
|
// {
|
|
|
|
// var o = new object[1];
|
|
|
|
// o[0] = self;
|
|
|
|
// return o as T;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// {
|
|
|
|
// if (self is object[] { Length: 1 } o)
|
|
|
|
// {
|
|
|
|
// return o[0] as T;
|
|
|
|
// }
|
|
|
|
// }
|
2024-06-12 16:01:56 +08:00
|
|
|
return self as T;
|
|
|
|
}
|
2023-06-29 14:57:11 +08:00
|
|
|
}
|
|
|
|
}
|