Click here to Skip to main content
15,886,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

How to make the generated code in Azure Machine Learning works on VB.NET?
I'm stuck on part of defining scorerequest variable value.

Original code from C#:
C#
public class StringTable
{
	public string[] ColumnNames { get; set; }
	public string[,] Values { get; set; }
}
class Program
{
			var scoreRequest = new
			{

				Inputs = new Dictionary<string, stringtable=""> () { 
					{ 
						"input1", 
						new StringTable() 
						{
							ColumnNames = new string[] {"DATA1", "DATA2", "DATA3", "DATA4", "DATA5", "DATA6"},
							Values = new string[,] {  { "0", "0", "0", "0", "0", "0"},  { "0", "0", "0", "0", "0", "0"},  }
						}
					},
				},
				GlobalParameters = new Dictionary<string, string="">() {}
			};
}


I'm not quite understand what the things that make it different. The main objective code are the "scoreRequest".

What I have tried:

VB.NET
Public Class StringTable
    Private privateColumnNames As String()
    Public Property ColumnNames() As String()
        Get
            Return privateColumnNames
        End Get
        Set(ByVal value As String())
            privateColumnNames = value
        End Set
    End Property
    Private privateValues As String(,)
    Public Property Values() As String(,)
        Get
            Return privateValues
        End Get
        Set(ByVal value As String(,))
            privateValues = value
        End Set
    End Property
End Class
Module Module1
	Dim scoreRequest = New With {Key .Inputs = New Dictionary(Of String, StringTable) (New String, StringTable() {{ "input1", New StringTable() With {.ColumnNames = New String() {"DATA1", "DATA2", "DATA3", "DATA4", "DATA5", "DATA6"}, .Values = New String(, ) { { "0", "0", "0", "0", "0", "0"}, { "0", "0", "0", "0", "0", "0"} }} }}), Key .GlobalParameters = New Dictionary(Of String, String)() With {}}
End Module
Posted
Comments
Ralf Meier 21-Oct-16 3:44am    
I think that there is missing the Type of ScoreRequest ...
Luiey Ichigo 21-Oct-16 3:57am    
Type of ScoreRequest? you mean CType things?
Ralf Meier 21-Oct-16 6:51am    
No ... I mean this :
Module Module1
Dim scoreRequest = New With {Key

New what ?
Luiey Ichigo 21-Oct-16 20:59pm    
The "New" part use to create a something in formatting (json). I have done something like this before, but not as complex as this. Like nested dictionary.

Dim telemetryDataPoint = New Object
telemetryDataPoint = New With {Key .Data1 = "ABC1",
.Data2 = "ABC2"
.Data3 = "ABC3"}

Dim messageString = JsonConvert.SerializeObject(telemetryDataPoint)
Ralf Meier 23-Oct-16 7:58am    
OK ... in your sample you created a new OBJECT ... this is a Type. In your Code-snippet you used NEW without a Type of anything.
Perhaps that works with C# - but for me it is ...?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900