This commit is contained in:
CortexCore
2024-06-12 16:49:42 +08:00
parent 126131b842
commit dab0eec438
7 changed files with 143 additions and 47 deletions

View File

@@ -6,20 +6,20 @@ namespace BITKit
{
public static T As<T>(this object self) where T : class
{
{
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;
}
}
// {
// 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;
// }
// }
return self as T;
}
}