Ram Prasad

Ram Prasad

  • NA
  • 326
  • 16.6k

Help with C# to compare data

Feb 12 2019 11:45 PM
am trying to compare a set of integers (say alpha) with the result i am getting (say result) if result is in alpha i should be able to get the output as mentioned in example below alpha = 0,1,2,3,4,5,6,7 result = 0,5,6
Final answer should be ABBBBAAB and what i am getting is ABBBBBBB BBBBBABB BBBBBBAB
public static int[] alpha = new int[8] { 0,1,2,3,4,5,6,7 };
public static void Main(string[] args)
{
// Lines of code
foreach (var jagged in manager.JaggedList)
{
// Lines of code
foreach (var item in Items)
{ Console.Write(item.Number); //For Ex output here is (0,5,6)
List<int> result = new List<int>();
result.Add(item.Number);
foreach (var Var in result)
{
for (int i = 0; i < alpha.Length; i++)
{
if (result.Contains(alpha[i]))
{
Console.Write(alpha[A]);
}
else
{
Console.Write(alpha[B]);
}
}
}
Console.WriteLine();
}
}

Answers (1)