Convert System.Web.UI.WebControls.Unit to int in c#

前端 未结 7 1580
我在风中等你
我在风中等你 2021-01-20 15:07

How can I convert from an ASP.NET Unit structure to int in c#? Or reverse?

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-20 15:53

    The Unit type has a Value property. This is a double, but you can cast it to an int if you want. The casting may cause a loss of precision, but you are probably aware of that.

    To create a Unit just use the constructor that takes an int.

提交回复
热议问题