Error with rounding extension on decimal - cannot be accessed with an instance reference; qualify it with a type name instead
问题 I've used extension methods numerous times, and haven't run into this issue. Anyone have any ideas why this is throwing an error? /// <summary> /// Rounds the specified value. /// </summary> /// <param name="value">The value.</param> /// <param name="decimals">The decimals.</param> /// <returns></returns> public static decimal Round (this decimal value, int decimals) { return Math.Round(value, decimals); } Usage: decimal newAmount = decimal.Parse("3.33333333333434343434"); this.rtbAmount.Text