1

How can I check if two ColorBlends have different Colors values?

I tried the following code

ColorBlend Blend1 = new ColorBlend();
Blend1.Colors = new Color[] { Color.White, Color.Black };
Blend1.Positions = new float[] { 0.0f, 1.0f };

ColorBlend Blend2 = new ColorBlend();
Blend2.Colors = new Color[] { Color.White, Color.Black };
Blend2.Positions = new float[] { 0.0f, 1.0f };

if (Blend1.Colors != Blend2.Colors)
{
    MessageBox.Show("Values are Different");
}

It doesn't work because when the Colors values are the same for both Blends, it still says they're not equal!

Devendra D. Chavan
  • 8,871
  • 4
  • 31
  • 35
Adrao
  • 412
  • 5
  • 18

1 Answers1

1

The check is not correct. You can't compare two arrays in that way. You have to go through and compare each item to make sure they are equal

TGH
  • 38,769
  • 12
  • 102
  • 135
  • i cant use Loops either because sometimes one blend has more colors then the other – Adrao Mar 11 '13 at 01:28
  • This answer might help you : http://stackoverflow.com/questions/1673347/linq-determine-if-two-sequences-contains-exactly-the-same-elements – TGH Mar 11 '13 at 01:32