Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# equivalent
Message
De
23/06/2007 19:03:50
 
 
À
23/06/2007 13:25:20
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Divers
Thread ID:
01235191
Message ID:
01235215
Vues:
15
John,

I put this through the code translator at http://www.carlosag.net/Tools/CodeTranslator/ and this is what it came up with, which is obviously not right:
if ((!(Array.IndexOf(loDesigner.RootComponent.GetType().GetInterfaces(), typeof(MyFramework.IContainerControl)) > -1) 
            && loDesigner.RootComponent)) 
{
    IsNot;
    this;
}
I'm guessing that it's probably more like this:
if (!Array.IndexOf(((object)loDesigner.RootComponent).GetType().GetInterfaces(), typeof(MyFramework.IContainerControl)) > -1) 
    && loDesigner.RootComponent != this) 
{
   // then do stuff
}
The "!" (or the VB "Not") is a bit confusing though. I'm translating that as meaning if the "Index is not > -1", which would be if the "Index < = -1". Hmmmm, which of course would be the same as the "Index == -1", since it's never going to be less than that. Maybe this would make a little more sense:
if (Array.IndexOf(((object)loDesigner.RootComponent).GetType().GetInterfaces(), typeof(MyFramework.IContainerControl)) == -1) 
    && loDesigner.RootComponent != this) 
{
   // then do stuff
}
Fun! =0)

~~Bonnie



>Hi,
>May I know the C# equivalent code for the VB.NET code below?
>
>
>If (Not Array.IndexOf(CType(loDesigner.RootComponent, Object).GetType().GetInterfaces(), GetType(MyFramework.IContainerControl)) > -1) AndAlso (loDesigner.RootComponent IsNot Me) Then
>
>
>Thank you
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform