OT - but can you help?

Posts   
 
    
Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 19-Dec-2004 16:27:11   

I know that this isn't LLGLPro related, but I'm hoping that this is so easy that it won't take much time for someone to respond. The issue is, I just can't figure out how to pass into the "ForeachMethod" method a parameter for the Type "ContactType", I can pass the collection (col) in, but how do I designate the TYPE of the identifier "o"??? Nothing I've tried seems to work. What am I missing here?

private void ForeachMethod(Type ContactType, EntityCollection col)
{           
  foreach (ContactType o in col)
  {
     ... <code>
  }
  // Compile error on ContactType: "Type name expected, but parameter name found".  HUH?
}

private void DoAThing()
{
  EntityCollection col = ((Account)_entity).Contacts.Items ;
  Type ContactType = Type.GetType("Contact") ;
  ForeachMethod (ContactType, col) ; 
}

You would think that passing in a type would work, but it doesn't. All I want to do is passing in the Type Name to enumerate against. Shouldn't this be trivial?

Thanks ahead of time! Jeff