码迷,mamicode.com
首页 > 编程语言 > 详细

C# Enum ToString

时间:2016-05-26 14:45:25      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

Test Code:

        [TestMethod]
        public void TestEnumToString()
        {
            var a = EnumType.A;
            
            string[] formats = {"", "G", "F", "D", "X" };

            foreach (var fmt in formats)
            {
                Console.WriteLine(a.ToString(fmt));
            }
        }

        public enum EnumType
        {
            A=1,
            B=2,
        }

 

Test Result:

Test Name:	TestEnumToString
Test Outcome:	Passed
Result StandardOutput:	
A
A
A
1
00000001

 

C# Enum ToString

标签:

原文地址:http://www.cnblogs.com/Froog/p/5530897.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!