문제

here's another quirk in .net 4.0 i found:

When i want to check if a variable, which holds a System.Drawing.Brush, holds a certain Brush, like:

using System.Drawing;

HisCell.Col == Brushes.White

it sometimes fails, despite the fact I assigned Brushes.White to HisCell.Col earlier.

How do i work around this bug?

올바른 솔루션이 없습니다

다른 팁

The Brushes class creates thread-local copies of its Brush objects. So, if you did a comparison of Brushes.White to a value that was set on another thread, they'd be different objects and result in false in equality because Brush does not implement equality so reference equality would be performed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top