c# - I am conflicted about using new with struct in .net -


I try to know about GDI + and to make a brush or pen, in most cases I have a color structure , So I try to know about it but now I have a disputed point, first of all, some people declare colors such as

  brush b1 = New solidbrush (Color. Form ARBB (255, 0, 0));  

or

  color myColor; MyColor = Color.FromArgb (255,0,0); Brush B2 = New Solidbrush (Michael);  

So anyone can tell me how to use Stranger without any color to call the default constructor of the new operator

Sorry This simple question but I tried to search about it and I'm new to programming.

Thanks

Anything that's going on here is that the interesting creator is non-public, and you still Pyogita method will create value through which you can get as trivial as your own code:

  struct {indirect personal Reedonli ET value; Private indirect (difference value) {this.value = value; } Make public static indirect (int value) {Return new indirect (value); }}} Straight direct {private readonly at value; Public value {this.value = value; }} Class program {static zero major () {var x = indirect Making (42); Var y = new direct (42); }}  

The occasional use is that the caller uses new ; Sometimes the expected use is that the caller receives value from a supportive method. In the case of color : the latter. In the case of SolidBrush : Formerly Note that this can be the case for both the struct and class types - this is not a specific factor.

In the case of color , actually you have more than many fields that are directly watching; For example, known caller , name , state - different for some ARGb values ​​"known" (From pre-determined designated lists); Some colors are ad-hoc (from ARGb data) the way you get the color determines these additional values.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -