I wasn't able to duplciate the problem you stated. The following code
works for me just fine.
public class Class1()
{ public static int testValue = 0; }
Class1 cla = new Class1();
Type t = typeof(Class1);
// Try against instance of class
t.InvokeMember("testValue",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.SetField, null, cla, new Object
[] {5});
// Try against no direct instance of class
t.InvokeMember("testValue",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.SetField, null, null, new Object
[] {6});
===================================
This list is hosted by DevelopMentor� http://www.develop.com
NEW! ASP.NET courses you may be interested in:
2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet
Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet
View archives and manage your subscription(s) at http://discuss.develop.com