zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/Model/Core/ClassHelper.cs

24 lines
525 B
C#

using System;
using System.Collections.Generic;
namespace ET
{
public static class ClassHelper
{
public static T As<T>(this object obj) where T : class
{
if (obj == null)
{
Log.Error($"obj == null");
return null;
}
T t = obj as T;
if (t == null)
{
Log.Error($"the cast of type :{obj.GetType()} to {typeof(T)} is invalid");
}
return t;
}
}
}