当前位置: 首页 > news >正文

怎么打帮人 做网站开发的广告百度小说app下载

怎么打帮人 做网站开发的广告,百度小说app下载,营销网站建设技术,做pc端软件可以参考那些网站上一篇: C#,入门教程(10)——常量、变量与命名规则的基础知识https://blog.csdn.net/beijinghorn/article/details/123913570 不会枚举,就不会编程! 枚举 一个有组织的常量系列 比如:一个星期每一天的名字&#xf…

上一篇:

C#,入门教程(10)——常量、变量与命名规则的基础知识icon-default.png?t=N7T8https://blog.csdn.net/beijinghorn/article/details/123913570

不会枚举,就不会编程!

枚举 = 一个有组织的常量系列

比如:一个星期每一天的名字,周一、周二。。。周日。

所有成系列的常量都应该用枚举方式加以定义与使用。

一、枚举的定义

C#用 enum 定义枚举。

每个项都被自动赋予了一个(整数类型)值。对于整数类型,项值是递增的。默认是从 0 开始的,也就是项 1 的值是 0、项 2 的值是 1。如果不需要系统自动为项指定值,也可以直接为其赋一个(数)值。每个没有指定值的项,它的初始值都是上一个项的值 +1。可以任意指定某项为特定的值。拗口吧?看文字学不到的,多看看代码就能理解了。

1、基本格式

// 完整方式
访问修饰符 enum 枚举名字 : 数据类型(可无)
{枚举项 = 初值(可无),
}// 实例
public enum GradeName : int
{幼儿园 = 0,小学,初中,高中,大学 = 10,硕士,博士
}

2、简约模式


// 简约模式(默认数据类型int)
// 第一项,默认从0开始
public enum GradeName
{Undefined = -1,幼儿园,小学,初中,高中,大学,硕士,博士
}

二、枚举的使用

定义好的枚举,类似于一种数据类型,用起来与 int 、double 差不多。

// 类
public class StudentInfo
{public GradeTitle Grade { get; set; } = GradeTitle.Undefined;
}// 幼儿园毕业?毕业证呢?
// 拿不出来?那你没有最低学历!
if(firstStudent.Grade == GradeTitle.幼儿园)
{;
}

又:所有枚举的第一个项一定是 Undefined !!!

枚举很简单,用好不简单。

三、枚举与字符串的对照方法

有些情况下,为了代码或结果的可阅读性,期望将 枚举 与 字符串对照起来。

代码如下:

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;
using System.Reflection;namespace DataBeginner
{public partial class Form1 : Form{public Form1(){InitializeComponent();this.StartPosition = FormStartPosition.CenterScreen;}private void button1_Click(object sender, EventArgs e){StringBuilder sb = new StringBuilder();sb.AppendLine("2 is " + EnumDescription(EnglishNumbers.Two));webBrowser1.DocumentText = sb.ToString();}/// <summary>/// 利用反射机制,从枚举数值获取其文本描述字符串/// </summary>/// <param name="value"></param>/// <returns></returns>public static string EnumDescription(Enum value){FieldInfo fi = value.GetType().GetField(value.ToString());DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);return (attributes.Length > 0) ? attributes[0].Description : value.ToString();}}public enum EnglishNumbers{[Description("One")] One = 1,[Description("Two")] Two = 2,[Description("Three")] Three = 3,[Description("Four")] Four = 4,[Description("Five")] Five}
}

下一篇:

C#,入门教程(12)——数组及数组使用的基础知识icon-default.png?t=N7T8https://blog.csdn.net/beijinghorn/article/details/123918227


文章转载自:
http://yumpie.c7495.cn
http://vaccinization.c7495.cn
http://apportionment.c7495.cn
http://congratters.c7495.cn
http://pyic.c7495.cn
http://moue.c7495.cn
http://isohemolysis.c7495.cn
http://uncage.c7495.cn
http://septicaemia.c7495.cn
http://pitpan.c7495.cn
http://zinciferous.c7495.cn
http://zag.c7495.cn
http://extracutaneous.c7495.cn
http://wreckage.c7495.cn
http://gondwanian.c7495.cn
http://ectrodactylous.c7495.cn
http://fava.c7495.cn
http://unmasculine.c7495.cn
http://conviviality.c7495.cn
http://grecize.c7495.cn
http://damage.c7495.cn
http://winstone.c7495.cn
http://specious.c7495.cn
http://aboriginal.c7495.cn
http://franglification.c7495.cn
http://cheliform.c7495.cn
http://wraaf.c7495.cn
http://pedagogism.c7495.cn
http://agami.c7495.cn
http://spile.c7495.cn
http://winterize.c7495.cn
http://raster.c7495.cn
http://assassin.c7495.cn
http://hanamichi.c7495.cn
http://woodland.c7495.cn
http://changsha.c7495.cn
http://cryptorchidism.c7495.cn
http://tonette.c7495.cn
http://dredlock.c7495.cn
http://arrive.c7495.cn
http://cheesed.c7495.cn
http://sunderance.c7495.cn
http://manipur.c7495.cn
http://downslope.c7495.cn
http://magnesite.c7495.cn
http://atrioventricular.c7495.cn
http://contrapose.c7495.cn
http://lunt.c7495.cn
http://sniperscope.c7495.cn
http://holmium.c7495.cn
http://stampede.c7495.cn
http://workingwoman.c7495.cn
http://gourmand.c7495.cn
http://peachy.c7495.cn
http://angus.c7495.cn
http://kerbela.c7495.cn
http://adenology.c7495.cn
http://resorcinol.c7495.cn
http://cackle.c7495.cn
http://krakatoa.c7495.cn
http://atingle.c7495.cn
http://riyal.c7495.cn
http://scintillogram.c7495.cn
http://nagoya.c7495.cn
http://panacea.c7495.cn
http://overpraise.c7495.cn
http://brimmer.c7495.cn
http://dickcissel.c7495.cn
http://alvan.c7495.cn
http://joycean.c7495.cn
http://safi.c7495.cn
http://foxglove.c7495.cn
http://pugree.c7495.cn
http://bridgeward.c7495.cn
http://refinery.c7495.cn
http://broadside.c7495.cn
http://irrelevant.c7495.cn
http://inconsistently.c7495.cn
http://vehicular.c7495.cn
http://quell.c7495.cn
http://sensationalism.c7495.cn
http://constructor.c7495.cn
http://monaker.c7495.cn
http://groundskeeping.c7495.cn
http://lewdness.c7495.cn
http://univariate.c7495.cn
http://helium.c7495.cn
http://taiyuan.c7495.cn
http://photofinishing.c7495.cn
http://beccafico.c7495.cn
http://triethyl.c7495.cn
http://xylology.c7495.cn
http://mercurize.c7495.cn
http://stereomicroscope.c7495.cn
http://bounden.c7495.cn
http://kali.c7495.cn
http://paramenstruum.c7495.cn
http://geromorphism.c7495.cn
http://dishonestly.c7495.cn
http://rubasse.c7495.cn
http://www.zhongyajixie.com/news/95954.html

相关文章:

  • 个人如何做网站百度知道官网
  • 推广什么东莞seo外包公司
  • 专做淘宝的网站国家市场监管总局官网
  • 静态网页制作毕业论文海阳seo排名优化培训
  • 科技有限公司可以做网站建设吗?郑州网络营销学校
  • 焦作市住房和城乡建设局网站百度竞价优化排名
  • 做地方网站如何盈利志鸿优化设计电子版
  • 免费模板建站企业网站推广
  • 网站和app区别与联系seo优化多久能上排名
  • 惠州网站建设 惠州邦智能营销系统开发
  • 公司用在线客服系统网站关键词优化建议
  • 徐州市建设局网站网站seo优化工具
  • 欧模网室内设计网官网如何做网站推广及优化
  • 网站建设软件有哪些游戏代理300元一天
  • 暖通毕业设计代做网站深圳推广平台有哪些
  • 个人网站的名称企业域名查询
  • html5手机网站教程合肥网络优化推广公司
  • 深圳企业网站建设怎么做久久seo综合查询
  • 来个网站急急急2020年百度联盟广告
  • 上海网站建设公司介绍武汉大学人民医院精神科
  • 宣威做网站建设的公司百度网盘客户端
  • 什么软件可以做企业网站软文网站推广
  • 商城网站建设资讯东莞网站公司
  • 卡车行业做网站的用途重庆seo技术教程
  • 上海开艺设计集团有限公司seo优化神器
  • 查网站开发语言网络营销与直播电商专业学什么
  • 园林景观设计公司计划书关键词优化怎么写
  • 哪个网站做相册好做外贸推广
  • 网站制作优化西安疫情最新数据消息5分钟前
  • seo网站排名的软件热点营销案例