将object类型参数转成泛型T
用Convert.ChangeType
1 | var a = (T) Convert.ChangeType(_arg, typeof(T)); |
比如分析Lua出入的参数时候,参数列表中的参数类型为object,但是回传给分析函数时候,回传参数类型为T
1 | /// <summary> |
UnityEngine.Object != 不能替换 ?.
1 | mCurrentMesh?.Clear(); |
上面两个判断 不相等
?. on a type deriving from
UnityEngine.Object
bypasses the lifetime check on the underlying Unity engine object.
原因在 这个帖子里面有说明.
主要是 Unity的Object 内部重载了 null 判等, 会去检查 对象是否被 GameObject.Destory(*)了 , 也就是 内存在,但是引擎中被销毁. 那样也认为null了
string前面的@符号
It marks the string as a verbatim string literal - anything in the string that would normally be interpreted as an escape sequence is ignored.
So “C:\Users\Rich” is the same as @”C:\Users\Rich”
There is one exception: an escape sequence is needed for the double quote. To escape a double quote, you need to put two double quotes in a row. For instance, @”””” evaluates to “.
也就是不用转译了,一般正则用