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
venketgiri
NA
3
0
problem running code in the article Late binding with Reflection by Sam Haider
Oct 20 2004 8:30 AM
the following is the code snippet and throws the exception: "object reference not set to an instance of and object" //--------code snippet--------- MethodInfo mi; Object result = null; object[] args = new object[]{"ABC123"}; try { Assembly assemblyInstance = Assembly.LoadFrom(@"C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\System.Data.dll"); Type[] types = assemblyInstance.GetTypes(); foreach (Type t in types) { mi = t.GetMethod("Constraint"); if (mi!=null) { string typeName = t.FullName; object lateBoundObj = assemblyInstance.CreateInstance(typeName); result = t.InvokeMember(typeName,BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, lateBoundObj, args); break; } } string name = result.ToString(); MessageBox.Show("Name is :",name); } catch(Exception ex) { MessageBox.Show("Error"); MessageBox.Show(ex.Message); } //-------------------------------------------
Reply
Answers (
0
)
Bug with HTML changes
.Net C# Developer Needed