这是统一C#如何正确使用信息:System.InvalidOperationException
//...
public static void Interupt(int Index, string Text){
try{
Change(Transforms[ Index ], Text);
}
catch{
throw new System.InvalidOperationException("Index: " + Index + " Is too large should be less than: " + Transforms.Count); // points me here
}
}
}
确定该代码指向我
throw, ...
我怎么让它指向我行,其中调用该函数?
,如:
using UnityEngine;
using System.Collections;
public class TestScript : MonoBehaviour {
void Start(){
SomeClass.Interupt(5, ""); // I want it to point me here
}
}
THO我也尝试这样做:
return throw new System.InvalidOperationException("Index: " + Index + " Is too large should be less than: " + Transforms.Count);
,但我得到:
error CS1525: Unexpected symbol `throw'
女巫是完全合乎逻辑的。
但我无法弄清楚是怎么处理这个事情,它指向我们的功能,而不是抛出线?
我希望任何人都有在Unity引擎
您需要读取整个堆栈跟踪。另外,不要吞下原始异常;你隐藏了关于实际问题的所有信息。 http://stackoverflow.com/a/2999314/34397 – SLaks
hmmm @Slaks如果我用throw new进行隐藏,...我如何将它指向函数女巫调用它而不是异常行? – MilitaryG