C# 敏捷1
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication2
{
public class Post
{
public string Title { get; set; } = "Title";
public string Content { get; set; }= "Content"; public int? age { get; set; } = ;
//新特性
public DateTime DateCreated { get; private set; } = DateTime.Now;
public List<Comment> Comments { get; private set; } = new List<Comment>();
public int AddOld()
{
return + ;
} //新特性还是用Lambda的语法而已
public int AddNew() => +;
public int AddNew(int a) => + a; } public class Comment
{ }
class Program
{ static void Main(string[] args)
{
var dictionary = new Dictionary<string, string>
{
{ "key1","value1"},
{ "key2","value2"}
}; //新特性
var dictionary1 = new Dictionary<string, string>
{
["key1"] = "value1",
["key2"] = "value2"
};
Console.WriteLine(dictionary); Post post = new Post(); string t1 = string.Format("{0}_{1}", post.Title, post.Content);
//新特性
string t2 = $"{post.Title}_{post.Content}";
Console.Write(t1); Console.Write("-"); Console.WriteLine(t2); Console.Write(post.AddOld()); Console.WriteLine(post.AddNew());
//if (x in (1, 2, 3))
//if (x in 1:5)
//if (x between(1, 5)) List<Tuple<string, string, string>> result = new List<Tuple<string, string, string>>();
result.Add(new Tuple<string, string, string>("fa", "q:" , "")); string obj = null ; switch (obj)
{
case "+" :
Console.WriteLine();
break;
case null:
Console.WriteLine();
break; default:
Console.WriteLine();
break;
}
//var tuple = (1, 2); // 使用语法糖创建元组
var tuple2 = Tuple.Create(, ); // 使用静态方法【Create】创建元组
var tuple3 = new Tuple<int, int>(, ); // 使用 new 运算符创建元组
Tuple<int, int> r = Divide(, );
Console.WriteLine($"{r.Item1}_{r.Item2}");
var z = M();
Console.WriteLine($"{z.Item1}_{z.Item2}"); Tuple<string, Nullable<int>>[] scores =
{ new Tuple<string, Nullable<int>>("Jack", ),
new Tuple<string, Nullable<int>>("Abbey", ),
new Tuple<string, Nullable<int>>("Dave", ),
new Tuple<string, Nullable<int>>("Sam", ),
new Tuple<string, Nullable<int>>("Ed", null),
new Tuple<string, Nullable<int>>("Penelope", ),
new Tuple<string, Nullable<int>>("Linda", ),
new Tuple<string, Nullable<int>>("Judith", ) };
int number;
double mean = ComputeMean(scores, out number);
Console.WriteLine("Average test score: {0:N2} (n={1})", mean, number); Console.ReadKey(true);
}
public static Tuple<int, int> Divide(int dividend, int divisor)
{
int result = dividend / divisor;
int reminder = dividend % divisor;
return Tuple.Create<int, int>(result, reminder); //返回两个相同类型元素的元组
}
public static Tuple<int, string> M()
{
Tuple<int, string> tuple = null;
return tuple = new Tuple<int, string>(, "Sucess");
} private static double ComputeMean(Tuple<string, Nullable<int>>[] scores, out int n)
{
n = ;
int sum = ;
foreach (var score in scores)
{
if (score.Item2.HasValue)
{
n += ;
sum += score.Item2.Value;
}
}
if (n > )
return sum / (double)n;
else
return ;
} } }
C# 敏捷1的更多相关文章
- [转载]敏捷开发之Scrum扫盲篇
现在敏捷开发是越来越火了,人人都在谈敏捷,人人都在学习Scrum和XP... 为了不落后他人,于是我也开始学习Scrum,今天主要是对我最近阅读的相关资料,根据自己的理解,用自己的话来讲述S ...
- 敏捷软件开发VS传统软件工程
敏捷软件开发:又称敏捷开发,是一种从1990年代开始逐渐引起广泛关注的一些新兴软件开发方法,是一种应对快速变化的需求的一种软件开发能力. 与传统软件工程相比,它们的具体名称.理念.过程.术语都不尽相同 ...
- 敏捷转型历程 - Sprint4 回顾会
我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...
- 敏捷转型历程 - Sprint3 回顾会
我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...
- 敏捷转型历程 - Sprint3 一团糟的演示会
我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...
- 敏捷转型历程 - Sprint3 Planning
我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...
- 敏捷转型历程 - Sprint3 Grooming
我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...
- TFS 2015 敏捷开发实践 – 在Kanban上运行一个Sprint
前言:在 上一篇 TFS2015敏捷开发实践 中,我们给大家介绍了TFS2015中看板的基本使用和功能,这一篇中我们来看一个具体的场景,如何使用看板来运行一个sprint.Sprint是Scrum对迭 ...
- 敏捷测试模式之Scrum及其实践
一. 敏捷开发模式简介 敏捷是近年来软件研发领域很火的一个词,采用敏捷开发模式的研发团队是越来越多了,尤其是敏捷模式中的Scrum更是佼佼者大行其道,这表明敏捷模式确有其好处,能给企业带来效率的 ...
- TFS 2015 敏捷开发实践 – 看板的使用
看板在现代应用开发过程中使用非常广泛,不管是使用传统的瀑布式开发还是敏捷开发,都可以使用看板管理.因为看板拥有简单的管理方法,直观的显示方式,所以很多软件开发团队选择使用看板进行软件开发管理.本文不在 ...
随机推荐
- nyoj 0269 VF(dp)
nyoj 0269 VF 意思大致为从1-10^9数中找到位数和为s的个数 分析:利用动态规划思想,一位一位的考虑,和s的范围为1-81 状态定义:dp[i][j] = 当前所有i位数的和为j的个数 ...
- 记录一次面试中的HTTP请求相关问题
1.HTTP中的状态码分别代表什么 比较基础,自行百度. 2.HTTP请求,响应头部content-length用来做什么的 答:Content-Length首部告诉浏览器报文中实体主体的大小.这 ...
- malloc用法整理
malloc函数原型:void *malloc(unsigned int num_bytes); //分配长度为num_bytes字节的内存块 返回值是void指针,void* 表示未确定类型的指针, ...
- nexus下载远程maven中央仓库的解决方案
参考:http://www.linuxidc.com/Linux/2014-03/98708.htm https://repo.maven.apache.org/maven2/.index/ 下载这两 ...
- flask项目结构(二)创建flask,同步docker
简介: 建立flask容易,那么部署就比较麻烦了,配这个,配那个,更新………… 所以我从构建,就考虑部署的问题,使用docker部署. 程序都打包进docker,本博客有相关文章. pycharn直接 ...
- Suffix树,后缀树
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- 深入理解java虚拟机---Class文件(二十)
无符号数.表 当实现了不同语言的编译器,比如jython,jruby等等,那么就可以利用这些语言编写代码,通过各自的编译器编译成符合jvm规范的字节码文件,就可以利用jvm来执行了. Class文件在 ...
- div 内 图片 垂直居中
vertical-align属性适用于 line-block: <div class="title"> <img src="img_p1_title.p ...
- DOS debug 命令的详细用法
DOS下的DEBUG命令的详细用法 2 推荐 名称 解释 格式 a (Assemble) 逐行汇编 a [address] c (Compare) 比较两内存块 c range addre ...
- 牛客多校第四场 F Beautiful Garden
链接:https://www.nowcoder.com/acm/contest/142/F来源:牛客网 题目描述 There's a beautiful garden whose size is n ...