Click here to Skip to main content
14,488,452 members
   

C#

 
AnswerRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 13:01
sitebuilderLuc Pattyn23-Jul-08 13:01 
GeneralRe: How to access an IEnumerable item using reflection Pin
Clive D. Pottinger23-Jul-08 13:53
MemberClive D. Pottinger23-Jul-08 13:53 
GeneralRe: How to access an IEnumerable item using reflection [modified] Pin
Luc Pattyn23-Jul-08 14:52
sitebuilderLuc Pattyn23-Jul-08 14:52 
GeneralRe: How to access an IEnumerable item using reflection Pin
Clive D. Pottinger23-Jul-08 15:44
MemberClive D. Pottinger23-Jul-08 15:44 
GeneralRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 15:51
sitebuilderLuc Pattyn23-Jul-08 15:51 
GeneralRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 16:13
sitebuilderLuc Pattyn23-Jul-08 16:13 
GeneralRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 15:16
sitebuilderLuc Pattyn23-Jul-08 15:16 
AnswerRe: How to access an IEnumerable item using reflection Pin
Clive D. Pottinger23-Jul-08 14:43
MemberClive D. Pottinger23-Jul-08 14:43 
Laugh | :laugh: Big Grin | :-D Smile | :) 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

GeneralWithout explicit GetEnumerator Pin
Luc Pattyn24-Jul-08 2:19
sitebuilderLuc Pattyn24-Jul-08 2:19 
Questiondropdownlist data fetch Pin
scottichrosaviakosmos23-Jul-08 8:02
Memberscottichrosaviakosmos23-Jul-08 8:02 
GeneralRe: dropdownlist data fetch Pin
nelsonpaixao23-Jul-08 14:43
Membernelsonpaixao23-Jul-08 14:43 
GeneralRe: dropdownlist data fetch Pin
scottichrosaviakosmos23-Jul-08 17:23
Memberscottichrosaviakosmos23-Jul-08 17:23 
AnswerRe: dropdownlist data fetch [modified] Pin
nelsonpaixao24-Jul-08 13:39
Membernelsonpaixao24-Jul-08 13:39 
QuestionProblem booking timeslots within a range of dates Pin
Twyce23-Jul-08 7:18
MemberTwyce23-Jul-08 7:18 
AnswerRe: Problem booking timeslots within a range of dates Pin
Luc Pattyn23-Jul-08 8:01
sitebuilderLuc Pattyn23-Jul-08 8:01 
QuestionWizard Control Suggestions Pin
jchalfant23-Jul-08 7:13
Memberjchalfant23-Jul-08 7:13 
AnswerRe: Wizard Control Suggestions Pin
Pete O'Hanlon23-Jul-08 9:45
subeditorPete O'Hanlon23-Jul-08 9:45 
GeneralRe: Wizard Control Suggestions Pin
jchalfant23-Jul-08 11:15
Memberjchalfant23-Jul-08 11:15 
GeneralRe: Wizard Control Suggestions Pin
Pete O'Hanlon24-Jul-08 10:07
subeditorPete O'Hanlon24-Jul-08 10:07 
QuestionXmlSchemaProvider XSD import problem Pin
Guinness4Strength23-Jul-08 5:52
MemberGuinness4Strength23-Jul-08 5:52 
QuestionWindows Service - Access is denied. Pin
dataminers23-Jul-08 5:23
Memberdataminers23-Jul-08 5:23 
AnswerRe: Windows Service - Access is denied. Pin
mark_w_23-Jul-08 5:46
Membermark_w_23-Jul-08 5:46 
GeneralRe: Windows Service - Access is denied. Pin
dataminers23-Jul-08 8:22
Memberdataminers23-Jul-08 8:22 
AnswerRe: Windows Service - Access is denied. Pin
Frank Horn23-Jul-08 6:52
MemberFrank Horn23-Jul-08 6:52 
AnswerRe: Windows Service - Access is denied. Pin
dataminers24-Jul-08 7:22
Memberdataminers24-Jul-08 7:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.