TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Administrator
Tech Writer
2.2k
1.5m
How do you know the method throws Exception or not via method API?
Apr 14 2003 9:11 PM
How do you know a method throws Exception or not via method API? For example the method
MyFn(string s)
in the followin class: // Rethrowing exceptions: using System; class MyClass { public static void Main() { MyClass x = new MyClass(); try { string s = null; x.MyFn(s); } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); } }
public void MyFn(string s)
{ if (s == null) throw(new ArgumentNullException()); } } Without looking at the actual method's body, how do we know whether or not the method throws what exception? I open the ildasm but no way I know what kind of Exception is thrown by the method
MyFn(string s)
? Unlike java, when method declared it says what exception(s) is(are) thrown, so via the API you know the method throws exception or not and what type of the exception as well. Is there any thing similar in C# beside the actual "throw" statement in the body? Any body has an idea how to know what exception(s) by not looking at the actual code which means via the API that normally what you get/given. Thanks
Reply
Answers (
0
)
translate from c++ header oruse com objects
databases