社区
C#
帖子详情
为什么输出结果不是1
xiaohai582
2012-02-02 02:49:38
enum orientation : byte
{
north=1,
south=2,
east=3,
west=4
}
class Program
{
static void Main(string[] args)
{
orientation myDirection = orientation.north;
Console.WriteLine("myDirection={0}",myDirection);
Console.ReadKey();
}
}
...全文
172
14
打赏
收藏
为什么输出结果不是1
enum orientation : byte { north=1, south=2, east=3, west=4 } class Program { static void Main(string[] args) { orientation myDirection = orientation.north; Console.WriteLine("myDirection={0}",myDirection); Console.ReadKey(); } }
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
14 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Jelena景
2012-02-02
打赏
举报
回复
class Program
{
static void Main(string[] args)
{
//orientation myDirection = orientation.north;
orientation myDirection = orientation.north;
Console.WriteLine("myDirection={0}", (int)myDirection);
Console.ReadKey();
}
enum orientation : byte
{
north = 1,
south = 2,
east = 3,
west = 4
}
}这样运行出来得到的是mydirection=1;
eRenChina
2012-02-02
打赏
举报
回复
Console.WriteLine("myDirection={0}",myDirection.ToString());
铜臂阿铁木
2012-02-02
打赏
举报
回复
Castiel丶Luo
2012-02-02
打赏
举报
回复
Console.WriteLine("myDirection={0}", (int)myDirection);
观光客
2012-02-02
打赏
举报
回复
要想输出1的话把你这句改一下
Console.WriteLine("myDirection={0}",((byte)myDirection).ToString());
Castiel丶Luo
2012-02-02
打赏
举报
回复
Console.WriteLine("myDirection={0}", ((int)myDirection).ToString());
昵称不能为空噢噢噢噢
2012-02-02
打赏
举报
回复
Console.WriteLine("myDirection={0}", (int) myDirection);
羊羽亻子
2012-02-02
打赏
举报
回复
如果你想输出1,enum orientation : int定义为int好啦
羊羽亻子
2012-02-02
打赏
举报
回复
((char)myDirection.north).ToString()
铜臂阿铁木
2012-02-02
打赏
举报
回复
[Quote=引用 4 楼 sunzongbao2007 的回复:]
所以
最起码的你把myDirection给ToString一下吧。
[/Quote]
这句话是对的。
至于
object的ToString是输出Type Name。
当我没说,因为这里不是因为这个。
铜臂阿铁木
2012-02-02
打赏
举报
回复
[Quote=引用 3 楼 sunzongbao2007 的回复:]
Console.WriteLine("myDirection={0}",myDirection);
最符合这个的重载是 WriteLine(string s, object o);
object的ToString是输出Type Name。
所以
最起码的你把myDirection给ToString一下吧。
[/Quote]
唔 我好像说的有点问题。
铜臂阿铁木
2012-02-02
打赏
举报
回复
Console.WriteLine("myDirection={0}",myDirection);
最符合这个的重载是 WriteLine(string s, object o);
object的ToString是输出Type Name。
所以
最起码的你把myDirection给ToString一下吧。
EnForGrass
2012-02-02
打赏
举报
回复
这是神马?
观光客
2012-02-02
打赏
举报
回复
myDirection的类型是枚举
YOLOv3&YOLOv5
输出结果
说明
本文使用的yolov3和yolov5工程文件均为github上ultralytics基于pytorch的v3和v5代码,其训练集
输出结果
类型基本一致,主要介绍了其
输出结果
,本文是一篇学习笔记本文使用的yolov3代码github下载地址:yolov3 模型训练具体步骤可查看此篇博客: yolov3模型训练——使用yolov3训练自己的模型本文使用的yolov5代码github下载地址:yolov5 模型训练具体步骤可查看此篇博客: yolov5模型训练———使用yolov5训练自己的数据集yolov3模型训
python3*1**3 表达式
输出结果
为_下列 Python语句的
输出结果
是?
【填空题】Pyhon语句序列"s1= 'red hat'; print(s1. title())”的运行结果是?【单选题】在 Python中一行书写两条语句时,语句之间可以使用作为分隔符【单选题】如在类中存在有_value,则表示它是【单选题】( )是 Python官方的扩展库命令,使用的较为普遍。【单选题】s1=[4,5,6];s2=s1;s1[1]=0;print(s2)的结果是【单选题】...
python语句print(type)的
输出结果
是_Python语句print(type(1/2))的
输出结果
是_____
Python语句print(type(1/2))的
输出结果
是_____答:以下不属于数字媒体技术特点的是哪项?答:超高清公民和组织因国防建设和军事活动在经济上受到直接损失的,应立即获得补偿答:×中国古代三大宫殿建筑天贶殿 、大成殿、太和殿分别位于 ( )答:泰山岱庙 曲阜孔庙 北京故宫Choose the answer that is closest in meaning to the under...
python输出type_Python语句print(type(1/2))的
输出结果
是_____
Python语句print(type(1/2))的
输出结果
是_____答:下面有关生态红线战略的说法正确的有:答:是非降型自然资本存量原则在我国的应用; 生态红线战略追求自然资本稳态; 满足强可持续和生态平衡的要求; 是在环境资源利用和生态保护方面确立的底线原则。智慧职教: Flash中将图形转换为图形元件的方法()答:F8 单击菜单“修改”/转换成元件能激活补体旁路途径的Ig是:答:Ig...
String.substring(1)的
输出结果
**String.substring(1)的
输出结果
点击进击源码: 可以看到,在最后,它输出了一个基于他本身的新的字符串,对正数字符串意义不是很大,但如果你输入了一个 x = -123456 String xString = Integer.toString(x); 那么,你在进行xString.substring(1)后 输出的结果,就没有了负号 ohhhhhhhhhh~ 最后再附图一张 在try的return中,字符串从-12345变成了12345 ...
C#
111,112
社区成员
642,554
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章