net core project. I am trying to make below object from my c# code.
{
"temperature_Mean_1_0":
{"Header":"Air Temp","Type":"temperature","Height":"2","SubType":"Min","BoomOrientation":"0.0",
"NorthReference":"true_north","Unit":"C","Scale":
"2.0","Offset":"0.0","DVLpyName":"temperature_1_1","FirstData":"26.98","Converted":"26.98",
"AssociatedDirection":"1"
}
}
Below is my code
IEnumerable<MastSetupInformation> mastSetupInformations = await _mastSetupInformationRepository.GetAsync(x => Ids.Contains(x.Id));
var data = (from l in mastSetupInformations
select (new Dictionary<string, object> { { l.Channel,
new MastSetupInformationAdfList {
MastSetupId = l.Id ,
Header = l.Header,
FirstData = l.FirstData,
Type = l.Type,
SubType = l.SubType,
Unit = l.Unit,
Height = l.Height,
BoomOrientation = l.BoomOrientation,
Scale = l.Scale,
Offset = l.Offset,
Converted = l.Converted,
DvlpyName = l.DvlpyName,
AssociatedDirection = l.AssociatedDirection,
NorthReference = MastLocation.NorthReference
} } }));
But in my code data variable holds below value
[
{
"temperature_Mean_1_0": {
"MastSetupId": 903,
"Header": "Horizontal Wind Speed Std. Dev. at 99m [m/s]",
"FirstData": "1.45",
"Type": "WindDirection",
"SubType": "STDev",
"Unit": "m/s",
"Height": 50,
"BoomOrientation": 0,
"Scale": 3,
"Offset": 0
}
}
]
I tried something below
object dataArray = data.Cast<object>().ToArray();
This dint work out so I am struggling to find what I am missing. Can someone help me to understand the issue. Any help would be appreciated. Thank you