c# 结构及赋值的写法。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace demo框架
{
    public partial class Form1 : Form
    {
        //结构
        public struct Jg {
            public String _name;
            public int _age;
            public Gren _grender;
        }

        //枚举类型
        public enum Gren { 
            男,
            女
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Jg jg;
            jg._name = "吴垒";
            jg._age = 30;
            jg._grender = Gren.男;


            Gren gren = Gren.男;
            String s = "男";
            Gren g = (Gren)Enum.Parse(typeof(Gren), s);
            Console.WriteLine(g);
            Console.ReadKey();
        }
    }
}
分类:

发表评论

邮箱地址不会被公开。