I have two objects in c#. One is for Header details (Dictionary) and other is for transaction. Both comes from different systems.
First Object - (of type NameValueCollection or any object where such mapping is present)
Name: "NameOfA"
Value : "A1" //Name of the property in second object
Name: : "NameOfB"
Value: "B1" //Name of the property in second object
Name: : "NameOfC"
Value: "C1" //Name of the property in second object
Name: : "NameOfD"
Value: "D1" //Name of the property in second object
Second Object (Custom type / JObject) -
"Property 1" : "Property 1 Value",
"Property 2" : "Property 2 Value",
"Property 3" : "Property 3 Value",
"Property 4: {
[
{
"A1" : "Value of A1", //The key "A1" here maps to the value property of First object
"Other Property 1" : "Value of other property 1",
"Other Property 2" : "Value of other property 2",
"Other Property 3" : 100
},
{
"B1" : "Value of B1",
"Other Property 1" : "Value of other property 1",
"Other Property 2" : "Value of other property 2",
"Other Property 3" : 100
},
{
"C1" : "Value of C1",
"Other Property 1" : "Value of other property 1",
"Other Property 2" : "Value of other property 2",
"Other Property 3" : 100
},
{
"D1" : 100; // Value of D1
"Other Property 1" : "Value of other property 1",
"Other Property 2" : "Value of other property 2",
"Other Property 3" : 100
},
]
}
The relation between two object is, the value of First object is a Key in Second object (In a sub array).
e.g. - The Value : "A1", This value "A1" of first object is key in second object :
"Property 4: {
[
{
*"A1"* : "Value of A1":
I want to process these two objects together, so i can get following format:
[
{
"NameOfTask": "NameOfA", // Name property of first object
"ValueOfTask": "Value of A1" //Value of Property A1 in second object
},
{
"NameOfTask": "NameOfB",
"ValueOfTask": "Value of B1"
},
{
"NameOfTask": "NameOfC",
"ValueOfTask": "Value of C1"
},
{
"NameOfTask": "NameOfD",
"ValueOfTask": 100
}
]
What could be the fastest algorithm to process such two different object as the object structure is totally custom and in my First object There could be 100 records and in second there could be 1000.
Thanks in advance.