Saturday, 15 January 2011

properties - C# property, is it possible to get around defining get without defining set (no backing variable)? -


Let's say that you do not have 300 properties with any backing variables, each of these properties decimals / doubles.

Example:

  get public decimal math { Set; }  

Now you have decided that each of those values ​​should be rounded.

I am looking for the easiest way to refact it without writing all those properties again.

Something that really works: D:

  public decimal point of view {Get Mathematics. Round (mathwell);} set; }   

You can create a new value type that pretends to be decimal, But Return Goal Value is something like this: Structure Round Dissemail {Public Decimal Value {get; Private set; } Public globular decimal (decimal value): this () {this.Value = value; } Public stable built-in operator decimal (walking round d) {return mathematics. Round (D. Vel); / html>

No comments:

Post a Comment