Click here to Skip to main content
15,890,557 members

Comments by enoughIsenough (Top 3 by date)

enoughIsenough 30-Mar-22 2:19am View    
Hi @Richard, Thanks for making it simple, for iterating over a dictionary

From the comment that you've added for iterating over a dictionary, the output is as I have mentioned in my question.

THE OUTPUT GOES LIKE BELOW:
The key prints test1, test2, test3, test4 as outputs // (foreach KeyValuePair<string, list<structure="">> pair in myDictionary)

and the value prints
A for test1 iteration
A, B for test2 iteration
A, C, D for test3 iteration
A, C, F for test4 iteration

Now since A is common for all the tests (which is test1, test2, test3 and test4)

I need my output over as
"The output key is: test1, the output value is A"
"The output key is: test2, the output value is A"
"The output key is: test3, the output value is A"
"The output key is: test4, the output value is A"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

If there is no common value for all the Keys(test1, test2, test3 and test4), then I need to throw an exception

That is, if the
The Key is: test1
The value is: A

The Key is: test2
The value is: B

The Key is: test3
The value is: C

The Key is: test4
The value is: D

In this case since, there is no common value in for all the Keys, I need to throw an exception

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

If there is 3 common values for keys (i.e., as mentioned below)
The Key is: test1
The value is: A
The value is: B

The Key is: test2
The value is: A
The value is: B
The value is: C


The Key is: test3
The value is: C
The value is: A

The Key is: test4
The value is: D

In this case, the output needs to be
The key is: test1 and the value is: A
The key is: test2 and the value is: A
The key is: test3 and the value is: A
The key is: test4 and the value is: D
enoughIsenough 30-Mar-22 1:53am View    
Deleted
Thanks for making it simple, for iterating over a dictionary

From the comment that you've added for iterating over a dictionary, the output is as I have mentioned in my question.

THE OUTPUT GOES LIKE BELOW:
The key prints test1, test2, test3, test4 as outputs // (foreach KeyValuePair<string, list<structure="">> pair in myDictionary)

and the value prints
A for test1 iteration
A, B for test2 iteration
A, C, D for test3 iteration
A, C, F for test4 iteration

Now since A is common for all the tests (which is test1, test2, test3 and test4)

I need my output over as
"The output key is: test1, the output value is A"
"The output key is: test2, the output value is A"
"The output key is: test3, the output value is A"
"The output key is: test4, the output value is A"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

If there is no common value for all the Keys(test1, test2, test3 and test4), then I need to throw an exception

That is, if the
The Key is: test1
The value is: A

The Key is: test2
The value is: B

The Key is: test3
The value is: C

The Key is: test4
The value is: D

In this case since, there is no common value in for all the Keys, I need to throw an exception

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

If there is 3 common values for keys (i.e., as mentioned below)
The Key is: test1
The value is: A
The value is: B

The Key is: test2
The value is: A
The value is: B
The value is: C


The Key is: test3
The value is: C
The value is: A

The Key is: test4
The value is: D

In this case, the output needs to be
The key is: test1 and the value is: A
The key is: test2 and the value is: A
The key is: test3 and the value is: A
The key is: test4 and the value is: D
enoughIsenough 28-Mar-22 1:59am View    
Hi, in this case the code is not entering into the foreach block