C#:如何长时间转换为ULONG [英] C#: How to convert long to ulong

查看:194
本文介绍了C#:如何长时间转换为ULONG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我BitConverter尝试,它需要一个字节数组,我没有that.I拥有的Int32,我想将其转换为UInt32的。

If i try with BitConverter,it requires a byte array and i don't have that.I have a Int32 and i want to convert it to UInt32.

在C ++中有与没有问题的。

In C++ there was no problem with that.

推荐答案

一个简单的转换是你所需要的。由于它可能会失去精度这样做,转换明确

A simple cast is all you need. Since it's possible to lose precision doing this, the conversion is explicit.

long x = 10;
ulong y = (ulong)x;

这篇关于C#:如何长时间转换为ULONG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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