I know that I can explicitly convert types in C# with the notation: (Type)Object
.
I am translating Visual Basic code to C#.
VB code:
TempTrans(j) = CType(FillTranslator.IndxLanguage.Item(j), Translator.IndxLangauges.IndxTranslation).Translations.Item(Row.Name.Trim) //This is the line I need help with!
Here is a struct (from the class Translator)
Structure IndxLangauges
Public IndxLanguage As Collection
Structure IndxTranslation
Public Language As Integer
Public Name As String
Public Translations As Collection
End Structure
End Structure
Also:
Private Shared FillTranslator As Translator.IndxLangauges
In C# I have:
public struct IndxLanguages
{
public System.Collections.Generic.List<string> IndxLanguage;
public struct IndxTranslation
{
public int Language;
public string Name;
public System.Collections.Generic.List<string> Translations;
};
};
private static Translator.IndxLanguages FillTranslator;
TempTrans[j] = ((Translator.IndxLanguages.IndxTranslation)FillTranslator.IndxLanguage[j]).Translations[Row.TypeName.Trim]; //Error here
I get the error: Cannot convert type string to Translator.IndxLanguages.IndxTranslation
I don't understand what is going on in the code directly following the conversion (In VB): .Translations.Item(Row.Name.Trim)
.
Could someone help me to understand the CType
code from VB, especially concerning the dot notation that follows?