你会在第二个方法处得到一个编译错误,因为这两个方法在类型消除后拥有一样的签名。
You'll get a compilation error on the second method because the two methods will have an identical signature after type erasure.
可以抛出您需要的任何类型的异常(已检查、运行时或错误),只要方法签名支持它即可。
You can throw any kind of exception you like - checked, runtime, or error - as long as the method signature supports it.
这种方法的缺点在于签名录入的错误或含糊不清可能会导致没有征兆的故障,这也就意味着代码可以编译,但在运行时无法正确完成操作。
The downside of this approach is the possibility that a typo or slight ambiguity in the signature will silently fail, which means the code will compile but "do the wrong thing" at runtime.
因此,该方法被包裹必须与委托的签名相匹配,否则会落得一个编译错误。
Hence, the method to be wrapped must match the signature of the delegate, otherwise would end up with a compilation error.
因此,该方法被包裹必须与委托的签名相匹配,否则会落得一个编译错误。
Hence, the method to be wrapped must match the signature of the delegate, otherwise would end up with a compilation error.
应用推荐