C# .NET - I want convert Visual RPG code to C# code, Please guide me to solve the task.

Asked By Anto Bilson on 19-Mar-15 10:48 AM
I have a visual RPG code to convert C# language. it is difficult to understand the syntax of visual RPG code. Please anyone help me to solve the task.
 
Ex:
BegProp RootPath Type(String) Access(*Public)
BegGet
If RootPaths[SelectedEnvironment] = *Nothing
Throw *New System.Exception(string.Format("ApplicationRootPath is not found in Environments.xml for {0} environment", ArrayOfEnvironNames[SelectedEnvironment]))
EndIf

LeaveSR RootPaths[SelectedEnvironment]

EndGet
EndProp
Robbe Morris replied to Anto Bilson on 19-Mar-15 10:48 AM
The code is essentially a .NET property on a class like the code below.  But, he's doing something with a collection/array called RootPaths.  Looks like a series of paths loaded from an xml document.  Depending on which global setting for the environment of the app, performing a "get" on the property RootPath will return the selected value from the collection.  In other words, just making it easier to get the root path everywhere in the code without having to write code to access the collection each time.

Unfortunately, I don't have the slightest idea what Visual RPG is.  So, I can't give you more guidance than that.  :)


private string _rootPath = string.Empty;
public string RootPath
{
    get
    {
    return _rootPath;
    }

}
Anto Bilson replied to Robbe Morris on 20-Mar-15 02:50 AM
Thanks for Help Robbie

AnyOne please try to help me convert to C# code

For Index(Count) to(Environments)
If (Name = ArrayOf[Countr] And EnvironTypes[Count] = "*Production")
Environment = Count
LeaveSR
EndIf
EndFor
and
Do FromVal(*Zero) ToVal(Count - 1) Index(Number)
EnvironList.Items.Add(EnvironNames[Number])
EndDo