Translation from C# to VB

C

Carlo

Please, help me to translate in VB the following C# line:

PropertyInfo pi= coll.GetType().GetProperty("Item",new
Type[]{typeof(int)});

Thank you very much

Carlo
 
H

Herfried K. Wagner [MVP]

Carlo said:
Please, help me to translate in VB the following C# line:

PropertyInfo pi= coll.GetType().GetProperty("Item",new
Type[]{typeof(int)});

\\\
Dim pi As PropertyInfo = _
coll.GetType().GetProperty("Item", New Type() {GetType(Integer)})
///
 
C

Carlo

Hello Herfried,
unfortunately, such translation does not works.

This is the original code:
protected virtual Type GetItemType(IList coll)
{
PropertyInfo pi= coll.GetType().GetProperty("Item",new
Type[]{typeof(int)});
return pi.PropertyType;
}
....and this is the translated code:
Protected Overridable Function GetItemType(ByVal coll As IList) As Type
Dim pi As PropertyInfo = coll.GetType().GetProperty("Item", New Type()
{GetType(Integer)})
Return pi.PropertyType
End Function 'GetItemType

IDE returns an error on "coll.GetType()", and the error message is: "GetType
is not a member of System.Collections.IList".

Any idea?

Thank you for the help.
Carlo


Herfried K. Wagner said:
Carlo said:
Please, help me to translate in VB the following C# line:

PropertyInfo pi= coll.GetType().GetProperty("Item",new
Type[]{typeof(int)});

\\\
Dim pi As PropertyInfo = _
coll.GetType().GetProperty("Item", New Type() {GetType(Integer)})
///
 
H

Herfried K. Wagner [MVP]

Carlo said:
IDE returns an error on "coll.GetType()", and the error message is:
"GetType is not a member of System.Collections.IList".

Try 'CObj(coll).GetType()'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top