在 C# 中将整数转换为字符 [英] Int to Char in C#

查看:19
本文介绍了在 C# 中将整数转换为字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到 Int 在有效值范围内,将 Int 值转换为 Utf16 中相应 Char 的最佳方法是什么?

What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?

推荐答案

(char)myint;

例如:

Console.WriteLine("(char)122 is {0}", (char)122);

产量:

(char)122 是 z

(char)122 is z

这篇关于在 C# 中将整数转换为字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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