c#结构类型和枚举类型怎么用?
1个回答
展开全部
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
enum NodeType
{
Point2D,
Point3D
}
struct Test
{
private NodeType nt;
public Test(NodeType _nt=NodeType.Point2D)
{
nt = _nt;
}
public override string ToString()
{
return nt.ToString();
//return base.ToString();
}
}
class Program
{
static void Main(string[] args)
{
Test ts = new Test();
Console.WriteLine(ts);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询