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

前端 未结 7 1583
我在风中等你
我在风中等你 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:47

    Use Unit.Value property. It will return double and you can cast it to int

    Something like (int)xyz.Value

    WEhere xyz is the unit variable

    To convert int to unit use new Unit(value)

提交回复
热议问题