转换System.Web.UI.WebControls.Unit在C#中为int [英] Convert System.Web.UI.WebControls.Unit to int in c#

查看:915
本文介绍了转换System.Web.UI.WebControls.Unit在C#中为int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何从一个ASP.NET的单位结构,在C#中诠释?或逆转?

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

推荐答案

单位类型有一个<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.unit.value%28v=VS.71%29.aspx\">Value物业。这是一个双,但你可以,如果你想将它转换为int。铸造可能导致precision损失,但你可能知道这​​一点。

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.

要创建一个单元只需要使用构造函数接受一个int

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

这篇关于转换System.Web.UI.WebControls.Unit在C#中为int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆