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 敏捷开发实践 – 看板的使用
看板在现代应用开发过程中使用非常广泛,不管是使用传统的瀑布式开发还是敏捷开发,都可以使用看板管理.因为看板拥有简单的管理方法,直观的显示方式,所以很多软件开发团队选择使用看板进行软件开发管理.本文不在 ...
随机推荐
- -L、-rpath和-rpath-link的区别
链接器ld的选项有 -L,-rpath 和 -rpath-link,看了下 man ld,大致是这个意思: -L:: “链接”的时候去找的目录,也就是所有的 -lFOO 选项里的库,都会先从 -L ...
- 两点(DFS)
福克斯在玩一款手机解迷游戏,这个游戏叫做”两点”.基础级别的时候是在一个n×m单元上玩的.像这样: 每一个单元有包含一个有色点.我们将用不同的大写字母来表示不同的颜色. 这个游戏的关键是要找出一个包含 ...
- learning scala ide tools install
reference : https://www.jetbrains.com/help/idea/install-and-set-up-product.html env in ubuntu 16.04 ...
- Oracle shrink space
一.开启表的行迁移 alter table table_name enable row movement; select 'alter table '||s.owner||'.'||s.table_n ...
- HTTP协议详细解析
HTTP协议详解 HTTP协议(HyperText Transfer Protocol,超文本传输协议)是因特网上应用最为广泛的一种网络传输协议,所有的WWW文件都必须遵守这个标准. HTTP是一个基 ...
- matlab中文本文件与图像转化
一 将图片转化为txt文本文件 a=imread('picture.bmp'); //读取picture.bmp图片 b=rgb2gray(a); //由rgb图 ...
- 学习python二三事儿(二)
多个变量赋值 Python允许你同时为多个变量赋值.例如: a = b = c = 1 以上实例,创建一个整型对象,值为1,三个变量被分配到相同的内存空间上. 您也可以为多个对象指定多个变量.例如: ...
- 《十天学会单片机和C语言编程》
<十天学会单片机和C语言编程> 大家注意了这个文件只有最新版迅雷可以下载,下面的lesson几就是第几课.点击右键使用迅雷下载. ed2k://|file|[十天学会单片机和C语言编程]. ...
- Ansible-playbook的简单使用 [转]
一. 介绍 ansbile-playbook是一系列ansible命令的集合,利用yaml 语言编写.playbook命令根据自上而下的顺序依次执行.同时,playbook开创了很多特性,它可以允许你 ...
- ios UITableView背景图片设置
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPa ...