What is wrong with this Anonymous Object Initialize syntax?
If (Not row Is Nothing) Then
Dim info As New CultureInfo(Conversions.ToString(row.Item("cultureId"))) With { _
.NumberFormat = New With {.CurrencySymbol = Conversions.ToString(row.Item("symbol")), _
.CurrencyGroupSeparator = Conversions.ToString(row.Item("thousSep")), _
.CurrencyDecimalSeparator = Conversions.ToString(row.Item("thousSep")), _
.CurrencyDecimalDigits = Conversions.ToInteger(row.Item("decimals")), _
.NumberGroupSeparator = Conversions.ToString(row.Item("thousSep")), _
.NumberDecimalSeparator = Conversions.ToString(row.Item("thousSep")), _
.NumberDecimalDigits = Conversions.ToInteger(row.Item("decimals"))}}}
hashtable.Add(key, info)
End If
It is a syntax error or object initialization type casting issue.
Thanks.
You’re trying to set the NumberFormat of the CultureInfo to an anonymous type instance. CultureInfo.NumberFormat is of type NumberFormatInfo. So you need to write: