Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to access an IEnumerable item using reflection [modified]

How to access an IEnumerable item using reflection [modified]

Scheduled Pinned Locked Moved C#
helptutorialquestion
10 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Clive D Pottinger
    wrote on last edited by
    #1

    Hello folks. It's been a while since I've managed to paint myself into a corner - but have no fear - I have not lost my talent for getting in over my head! This time I am working with reflection and trying to access different classes generically . But I have run into a problem trying to get some information out of an object when the object's class isn't known until runtime:

    public void GetDataFromStaticClassX(string MethodToCall, object[]MethodParms)
    {
    private const BindingFlags StaticMethodBindings = BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod;
    private const BindingFlags InstancePropertyBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;
    private const BindingFlags InstanceMethodBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;

    object returnedInfo = typeof(X).InvokeMember(MethodToCall, StaticMethodBindings, null, null, MethodParms);

    That works: the proper method is called and the result is put in returnedInfo. However, the result could be any of a number of different classes, depending on the value of MethodToCall. The only thing I now for sure about the contents of returnedInfo is that it will implement IEnumerable.

    int returnedInfoCount = (int)returnedInfo.GetType().InvokeMember("Count", InstancePropertyBindings, null, returnedInfo , null);

    That works too. I can see the proper value being assigned to returnedInfoCount. Now comes the kicker: I want to access the first entry in returnedInfo. I tried this

    object myData = returnedInfo.GetType().InvokeMember("Item", InstanceMethodBindings, null, returnedInfo, new object[] {0});

    No luck. The exception says method Item is not found.

    returnedInfo.GetType().InvokeMember("MoveNext", InstanceMethodBindings, null, returnedInfo, null);
    object myData = returnedInfo.GetType().InvokeMember("Current", InstanceMethodBindings, null, returnedInfo, null);

    Also dies - "MoveNext" is not found. Does anyone have any ideas of how I can get at the first entry in returnedInfo? Many thanks if you are kind enough to look into this. Even more if you have a suggestion/solution/idea/words of encouragement... edit: small error in the example code

    Clive Pottinger Victoria, BC

    modified on Wednesday, July 23, 2008 6:54 PM

    L 1 Reply Last reply
    0
    • C Clive D Pottinger

      Hello folks. It's been a while since I've managed to paint myself into a corner - but have no fear - I have not lost my talent for getting in over my head! This time I am working with reflection and trying to access different classes generically . But I have run into a problem trying to get some information out of an object when the object's class isn't known until runtime:

      public void GetDataFromStaticClassX(string MethodToCall, object[]MethodParms)
      {
      private const BindingFlags StaticMethodBindings = BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod;
      private const BindingFlags InstancePropertyBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;
      private const BindingFlags InstanceMethodBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;

      object returnedInfo = typeof(X).InvokeMember(MethodToCall, StaticMethodBindings, null, null, MethodParms);

      That works: the proper method is called and the result is put in returnedInfo. However, the result could be any of a number of different classes, depending on the value of MethodToCall. The only thing I now for sure about the contents of returnedInfo is that it will implement IEnumerable.

      int returnedInfoCount = (int)returnedInfo.GetType().InvokeMember("Count", InstancePropertyBindings, null, returnedInfo , null);

      That works too. I can see the proper value being assigned to returnedInfoCount. Now comes the kicker: I want to access the first entry in returnedInfo. I tried this

      object myData = returnedInfo.GetType().InvokeMember("Item", InstanceMethodBindings, null, returnedInfo, new object[] {0});

      No luck. The exception says method Item is not found.

      returnedInfo.GetType().InvokeMember("MoveNext", InstanceMethodBindings, null, returnedInfo, null);
      object myData = returnedInfo.GetType().InvokeMember("Current", InstanceMethodBindings, null, returnedInfo, null);

      Also dies - "MoveNext" is not found. Does anyone have any ideas of how I can get at the first entry in returnedInfo? Many thanks if you are kind enough to look into this. Even more if you have a suggestion/solution/idea/words of encouragement... edit: small error in the example code

      Clive Pottinger Victoria, BC

      modified on Wednesday, July 23, 2008 6:54 PM

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      :confused: Not sure I understood you correctly, but if your type implements IEnumerable, that means exactly one thing: it has a GetEnumerator() method. So take it from there, get that Enumerator and use it, IMO no further reflection is required. And a foreach would do that automatically, so why don't you try:

      foreach(MyType item in myEnumerableType) {
      item.SomeMethod();
      }

      :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      Voting for dummies? No thanks. X|


      C 2 Replies Last reply
      0
      • L Luc Pattyn

        :confused: Not sure I understood you correctly, but if your type implements IEnumerable, that means exactly one thing: it has a GetEnumerator() method. So take it from there, get that Enumerator and use it, IMO no further reflection is required. And a foreach would do that automatically, so why don't you try:

        foreach(MyType item in myEnumerableType) {
        item.SomeMethod();
        }

        :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        Voting for dummies? No thanks. X|


        C Offline
        C Offline
        Clive D Pottinger
        wrote on last edited by
        #3

        Thanks Luc, but it won't work. However, building on your example may make it a little simpler to illustrate my problem:

        public void myGetData(string myEnumerableTypeName)
        {
        object myEnumerableType = (code that returns myEnumerableType as an object)

        foreach(MyType item in myEnumerableType)
        {
        item.SomeMethod();
        }
        }

        Note that I have myEnumerableType, but only as an instance of an object, and objects don't implement IEnumerable. If I could cast myEnumerableType as an IEnumerable object, then I could write

        foreach(MyType item in (IEnumerable)myEnumerableType)

        But, IEnumerable is an interface, so casting is not allowed. If I could dynamically implement IEnumerable, perhaps

        foreach(MyType item in myEnumerableType:IEnumerable)

        but the Gods of Syntax threw a bolt of lighting at me for just suggesting it. I can get the original type of myEnumerableType

        Type origType = myEnumberableType.GetType();

        Again, if I could dynamically cast then I could do

        foreach(MyType item in ((Type)origType)myEnumerableType)

        but that time the GoS punished me by replacing all my screensavers with jpegs of Ugly Betty.

        Clive Pottinger Victoria, BC

        L 2 Replies Last reply
        0
        • L Luc Pattyn

          :confused: Not sure I understood you correctly, but if your type implements IEnumerable, that means exactly one thing: it has a GetEnumerator() method. So take it from there, get that Enumerator and use it, IMO no further reflection is required. And a foreach would do that automatically, so why don't you try:

          foreach(MyType item in myEnumerableType) {
          item.SomeMethod();
          }

          :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          Voting for dummies? No thanks. X|


          C Offline
          C Offline
          Clive D Pottinger
          wrote on last edited by
          #4

          :laugh: :-D :) I GOT IT ! ! ! Thank you Luc. Your suggestion of using Enumerator helped me find the solution.

          public void GetDataFromStaticClassX(string MethodToCall, object[]MethodParms)
          {
          private const BindingFlags StaticMethodBindings = BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod;
          private const BindingFlags InstancePropertyBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;
          private const BindingFlags InstanceMethodBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;

          object returnedInfo = typeof(X).InvokeMember(MethodToCall, StaticMethodBindings, null, null, MethodParms);

          int returnedInfoCount = (int)returnedInfo.GetType().InvokeMember("Count", InstancePropertyBindings, null, returnedInfo , null);

          object enumeratorObj = returnedInfo.GetType().InvokeMember("GetEnumerator", InstanceMethodBindings, null, returnedInfo , null);
          object moved = enumeratorObj .GetType().InvokeMember("MoveNext", InstanceMethodBindings, null, enumeratorObj, null);
          object data = enumeratorObj .GetType().InvokeMember("Current", InstancePropertyBindings, null, enumeratorObj, null);

          }

          That did it: enumeratorObj is set to an object that reflects returnedInfo's enumerator. moved gets set to true, showing that the call to the enumerator worked. data gets set to the first entry in returnedInfo - YEAH!!!! Thanks again.

          Clive Pottinger Victoria, BC

          L 1 Reply Last reply
          0
          • C Clive D Pottinger

            Thanks Luc, but it won't work. However, building on your example may make it a little simpler to illustrate my problem:

            public void myGetData(string myEnumerableTypeName)
            {
            object myEnumerableType = (code that returns myEnumerableType as an object)

            foreach(MyType item in myEnumerableType)
            {
            item.SomeMethod();
            }
            }

            Note that I have myEnumerableType, but only as an instance of an object, and objects don't implement IEnumerable. If I could cast myEnumerableType as an IEnumerable object, then I could write

            foreach(MyType item in (IEnumerable)myEnumerableType)

            But, IEnumerable is an interface, so casting is not allowed. If I could dynamically implement IEnumerable, perhaps

            foreach(MyType item in myEnumerableType:IEnumerable)

            but the Gods of Syntax threw a bolt of lighting at me for just suggesting it. I can get the original type of myEnumerableType

            Type origType = myEnumberableType.GetType();

            Again, if I could dynamically cast then I could do

            foreach(MyType item in ((Type)origType)myEnumerableType)

            but that time the GoS punished me by replacing all my screensavers with jpegs of Ugly Betty.

            Clive Pottinger Victoria, BC

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi Clive, First a few minor corrections to your message:

            cpotting wrote:

            but only as an instance of an object, and objects don't implement IEnumerable.

            - objects are instances of classes - classes can implement an interface - objects can be cast to an interface, the compiler will accept, the run-time check may fail; in your case, it cannot prove the object IS an instance of an IEnumerable class, so it refuses to cast. Now IMO this is the right plan of attack: - get your object; - use reflection to execute its GetEnumerator() method and store the result as a new object (of type IEnumerator), say myEnumerator. - on myEnumerator, call methods Reset(), MoveNext() and the property Current as you see fit; no need for reflection here. This is code I have running:

            public override void Run(int arg) {
            MyList list=new MyList();
            IEnumerator ienumer= typeof(MyList).InvokeMember("GetEnumerator", InstanceMethodBindings, null, list, null)
            as IEnumerator;
            log("ienumer="+ienumer);
            while (ienumer.MoveNext()) log((string)ienumer.Current);
            }

            public class MyList : IEnumerable {
            private List list=new List();

            public MyList() {
            	list.Add("aaa");
            	list.Add("bbb");
            	list.Add("ccc");
            }
            
            public IEnumerator GetEnumerator() { return list.GetEnumerator(); } // LINE WAS MISSING!
            

            }

            Hope this helps. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            Voting for dummies? No thanks. X|


            modified on Wednesday, July 23, 2008 8:58 PM

            C 1 Reply Last reply
            0
            • C Clive D Pottinger

              Thanks Luc, but it won't work. However, building on your example may make it a little simpler to illustrate my problem:

              public void myGetData(string myEnumerableTypeName)
              {
              object myEnumerableType = (code that returns myEnumerableType as an object)

              foreach(MyType item in myEnumerableType)
              {
              item.SomeMethod();
              }
              }

              Note that I have myEnumerableType, but only as an instance of an object, and objects don't implement IEnumerable. If I could cast myEnumerableType as an IEnumerable object, then I could write

              foreach(MyType item in (IEnumerable)myEnumerableType)

              But, IEnumerable is an interface, so casting is not allowed. If I could dynamically implement IEnumerable, perhaps

              foreach(MyType item in myEnumerableType:IEnumerable)

              but the Gods of Syntax threw a bolt of lighting at me for just suggesting it. I can get the original type of myEnumerableType

              Type origType = myEnumberableType.GetType();

              Again, if I could dynamically cast then I could do

              foreach(MyType item in ((Type)origType)myEnumerableType)

              but that time the GoS punished me by replacing all my screensavers with jpegs of Ugly Betty.

              Clive Pottinger Victoria, BC

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              An even cleaner approach is by replacing the Invoke statement by:

              IEnumerator ienumer=(IEnumerator)typeof(IEnumerable).
              	InvokeMember("GetEnumerator", InstanceMethodBindings, null, list, null);
              

              :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              Voting for dummies? No thanks. X|


              1 Reply Last reply
              0
              • L Luc Pattyn

                Hi Clive, First a few minor corrections to your message:

                cpotting wrote:

                but only as an instance of an object, and objects don't implement IEnumerable.

                - objects are instances of classes - classes can implement an interface - objects can be cast to an interface, the compiler will accept, the run-time check may fail; in your case, it cannot prove the object IS an instance of an IEnumerable class, so it refuses to cast. Now IMO this is the right plan of attack: - get your object; - use reflection to execute its GetEnumerator() method and store the result as a new object (of type IEnumerator), say myEnumerator. - on myEnumerator, call methods Reset(), MoveNext() and the property Current as you see fit; no need for reflection here. This is code I have running:

                public override void Run(int arg) {
                MyList list=new MyList();
                IEnumerator ienumer= typeof(MyList).InvokeMember("GetEnumerator", InstanceMethodBindings, null, list, null)
                as IEnumerator;
                log("ienumer="+ienumer);
                while (ienumer.MoveNext()) log((string)ienumer.Current);
                }

                public class MyList : IEnumerable {
                private List list=new List();

                public MyList() {
                	list.Add("aaa");
                	list.Add("bbb");
                	list.Add("ccc");
                }
                
                public IEnumerator GetEnumerator() { return list.GetEnumerator(); } // LINE WAS MISSING!
                

                }

                Hope this helps. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                Voting for dummies? No thanks. X|


                modified on Wednesday, July 23, 2008 8:58 PM

                C Offline
                C Offline
                Clive D Pottinger
                wrote on last edited by
                #7

                Luc Pattyn wrote:

                Now IMO this is the right plan of attack: - get your object; - use reflection to execute its GetEnumerator() method and store the result as a new object (of type IEnumerator), say myEnumerator. - on myEnumerator, call methods Reset(), MoveNext() and the property Current as you see fit; no need for reflection here. This is code I have running: public override void Run(int arg) { MyList list=new MyList(); IEnumerator ienumer= typeof(MyList).InvokeMember("GetEnumerator", InstanceMethodBindings, null, list, null) as IEnumerator; log("ienumer="+ienumer); while (ienumer.MoveNext()) log((string)ienumer.Current); } public class MyList : IEnumerable { private List list=new List(); public MyList() { list.Add("aaa"); list.Add("bbb"); list.Add("ccc"); } public IEnumerator GetEnumerator() { return list.GetEnumerator(); } // LINE WAS MISSING! }

                Thanks again, Luc. I did not see this and your next post until after I posted my answer. But it is enlightening to see your approach anyway. There would be two problems with implementing the solution you give above: 1) It requires the me to declare ienumer as type IEnumerable. I do not have this ability (I think it is because we are still using .NET 2.0 here). 2) the line

                while (ienumer.MoveNext()) log((string)ienumer.Current);

                requires that the type returned by ienumer.Current be hardcoded as string. But I cannot hardcode the type, because, in my situation, I may be working on MyList, or MyIntList, or MySomeOtherClassList... None the less, your suggestions got me past both issues and my code is working wonderfully. I know I would still be floundering about if it wasn't for guru's like you and the rest of the TheCodeProject folks. Cheers!

                Clive Pottinger Victoria, BC

                L 2 Replies Last reply
                0
                • C Clive D Pottinger

                  Luc Pattyn wrote:

                  Now IMO this is the right plan of attack: - get your object; - use reflection to execute its GetEnumerator() method and store the result as a new object (of type IEnumerator), say myEnumerator. - on myEnumerator, call methods Reset(), MoveNext() and the property Current as you see fit; no need for reflection here. This is code I have running: public override void Run(int arg) { MyList list=new MyList(); IEnumerator ienumer= typeof(MyList).InvokeMember("GetEnumerator", InstanceMethodBindings, null, list, null) as IEnumerator; log("ienumer="+ienumer); while (ienumer.MoveNext()) log((string)ienumer.Current); } public class MyList : IEnumerable { private List list=new List(); public MyList() { list.Add("aaa"); list.Add("bbb"); list.Add("ccc"); } public IEnumerator GetEnumerator() { return list.GetEnumerator(); } // LINE WAS MISSING! }

                  Thanks again, Luc. I did not see this and your next post until after I posted my answer. But it is enlightening to see your approach anyway. There would be two problems with implementing the solution you give above: 1) It requires the me to declare ienumer as type IEnumerable. I do not have this ability (I think it is because we are still using .NET 2.0 here). 2) the line

                  while (ienumer.MoveNext()) log((string)ienumer.Current);

                  requires that the type returned by ienumer.Current be hardcoded as string. But I cannot hardcode the type, because, in my situation, I may be working on MyList, or MyIntList, or MySomeOtherClassList... None the less, your suggestions got me past both issues and my code is working wonderfully. I know I would still be floundering about if it wasn't for guru's like you and the rest of the TheCodeProject folks. Cheers!

                  Clive Pottinger Victoria, BC

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  Hi Clive, You're welcome. Yours was an interesting question, and I happened to have been investigating IEnumerable and IEnumerator all day. My reflection experience is limited so I took the opportunity you offered. :-D

                  cpotting wrote:

                  It requires the me to declare ienumer as type IEnumerable. I do not have this ability (I think it is because we are still using .NET 2.0 here).

                  I have been running my tests targetting 2.0 But ienumer is an IEnumerator, not an IEnumerable, maybe that got you fooled somehow.

                  cpotting wrote:

                  requires that the type returned by ienumer.Current be hardcoded as string.

                  I am not saying you must do it this way, the only thing I meant was once you got an IEnumerator, it is a real one, you can use it with managed code without reflection, but yes you have to somehow cast Current to the appropriate type so you can really use it. But this may well be doable with little or no reflection. Certainly the MoveNext() does not need reflection at all. :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  Voting for dummies? No thanks. X|


                  1 Reply Last reply
                  0
                  • C Clive D Pottinger

                    Luc Pattyn wrote:

                    Now IMO this is the right plan of attack: - get your object; - use reflection to execute its GetEnumerator() method and store the result as a new object (of type IEnumerator), say myEnumerator. - on myEnumerator, call methods Reset(), MoveNext() and the property Current as you see fit; no need for reflection here. This is code I have running: public override void Run(int arg) { MyList list=new MyList(); IEnumerator ienumer= typeof(MyList).InvokeMember("GetEnumerator", InstanceMethodBindings, null, list, null) as IEnumerator; log("ienumer="+ienumer); while (ienumer.MoveNext()) log((string)ienumer.Current); } public class MyList : IEnumerable { private List list=new List(); public MyList() { list.Add("aaa"); list.Add("bbb"); list.Add("ccc"); } public IEnumerator GetEnumerator() { return list.GetEnumerator(); } // LINE WAS MISSING! }

                    Thanks again, Luc. I did not see this and your next post until after I posted my answer. But it is enlightening to see your approach anyway. There would be two problems with implementing the solution you give above: 1) It requires the me to declare ienumer as type IEnumerable. I do not have this ability (I think it is because we are still using .NET 2.0 here). 2) the line

                    while (ienumer.MoveNext()) log((string)ienumer.Current);

                    requires that the type returned by ienumer.Current be hardcoded as string. But I cannot hardcode the type, because, in my situation, I may be working on MyList, or MyIntList, or MySomeOtherClassList... None the less, your suggestions got me past both issues and my code is working wonderfully. I know I would still be floundering about if it wasn't for guru's like you and the rest of the TheCodeProject folks. Cheers!

                    Clive Pottinger Victoria, BC

                    L Offline
                    L Offline
                    Luc Pattyn
                    wrote on last edited by
                    #9

                    Hi Clive, FYI: I just learned that static classes can't implement interfaces, maybe that is what held you back. My experiments were on instances right away, but I just tried to simplify to something static and started to get compile errors. Of course, an explicit call to a GetEnumerator method is always possible, and a properly implemented Enumerator always returns a new object, with its own current pointer, so multiple enumerators could be walking the same IEnumerable at their own pace. :)

                    Luc Pattyn [Forum Guidelines] [My Articles]


                    Voting for dummies? No thanks. X|


                    1 Reply Last reply
                    0
                    • C Clive D Pottinger

                      :laugh: :-D :) I GOT IT ! ! ! Thank you Luc. Your suggestion of using Enumerator helped me find the solution.

                      public void GetDataFromStaticClassX(string MethodToCall, object[]MethodParms)
                      {
                      private const BindingFlags StaticMethodBindings = BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod;
                      private const BindingFlags InstancePropertyBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;
                      private const BindingFlags InstanceMethodBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;

                      object returnedInfo = typeof(X).InvokeMember(MethodToCall, StaticMethodBindings, null, null, MethodParms);

                      int returnedInfoCount = (int)returnedInfo.GetType().InvokeMember("Count", InstancePropertyBindings, null, returnedInfo , null);

                      object enumeratorObj = returnedInfo.GetType().InvokeMember("GetEnumerator", InstanceMethodBindings, null, returnedInfo , null);
                      object moved = enumeratorObj .GetType().InvokeMember("MoveNext", InstanceMethodBindings, null, enumeratorObj, null);
                      object data = enumeratorObj .GetType().InvokeMember("Current", InstancePropertyBindings, null, enumeratorObj, null);

                      }

                      That did it: enumeratorObj is set to an object that reflects returnedInfo's enumerator. moved gets set to true, showing that the call to the enumerator worked. data gets set to the first entry in returnedInfo - YEAH!!!! Thanks again.

                      Clive Pottinger Victoria, BC

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #10

                      Hi Clive, I continued looking for a way without calling GetEnumerator explicitly, and this now works fine for me:

                      public override void Run(int arg) {
                      Type type=Type.GetType("LPExplorer.CPTest_Enumerator+MyList");
                      log("type="+type);
                      IEnumerable aList=System.Activator.CreateInstance(type) as IEnumerable;
                      log("aList="+aList);
                      if (aList!=null) foreach (string s in aList) log(s);
                      }

                      public class MyList : IEnumerable {
                      private List list=new List();

                      public MyList() {
                      	list.Add("aaa");
                      	list.Add("bbb");
                      	list.Add("ccc");
                      }
                      
                      public IEnumerator GetEnumerator() { return list.GetEnumerator(); }
                      

                      }

                      So once the object (aList) exists I don't need reflection to enumerate, provided I know (or the code somehow finds out) what the type of the items is. As I mentioned before, aList must be an object, i.e. an instance; it would not work on static classes. :)

                      Luc Pattyn [Forum Guidelines] [My Articles]


                      Voting for dummies? No thanks. X|


                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups