Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do this without unchecked?

Tags:

c#

unchecked

a few months ago I wrote this code because it was the only way I could think to do it(while learning C#), well. How would you do it? Is unchecked the proper way of doing this?

unchecked //FromArgb takes a 32 bit value, though says it's signed. Which colors shouldn't be.
{
  _EditControl.BackColor = System.Drawing.Color.FromArgb((int)0xFFCCCCCC);
}
like image 249
Earlz Avatar asked Feb 23 '10 21:02

Earlz


1 Answers

It takes a signed int b/c this dates back to the time when VB.NET didn't have unsigned values. So in order to maintain compatibility between C# and VB.NET, all the BCL libraries utilize signed values, even if it does not make logical sense.

like image 171
Nick Avatar answered Oct 05 '22 16:10

Nick