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的更多相关文章

  1. [转载]敏捷开发之Scrum扫盲篇

    现在敏捷开发是越来越火了,人人都在谈敏捷,人人都在学习Scrum和XP...      为了不落后他人,于是我也开始学习Scrum,今天主要是对我最近阅读的相关资料,根据自己的理解,用自己的话来讲述S ...

  2. 敏捷软件开发VS传统软件工程

    敏捷软件开发:又称敏捷开发,是一种从1990年代开始逐渐引起广泛关注的一些新兴软件开发方法,是一种应对快速变化的需求的一种软件开发能力. 与传统软件工程相比,它们的具体名称.理念.过程.术语都不尽相同 ...

  3. 敏捷转型历程 - Sprint4 回顾会

    我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...

  4. 敏捷转型历程 - Sprint3 回顾会

    我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...

  5. 敏捷转型历程 - Sprint3 一团糟的演示会

    我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...

  6. 敏捷转型历程 - Sprint3 Planning

    我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...

  7. 敏捷转型历程 - Sprint3 Grooming

    我: Tech Leader 团队:团队成员分布在两个城市,我所在的城市包括我有4个成员,另外一个城市包括SM有7个成员.另外由于我们的BA离职了,我暂代IT 的PO 职位.PM和我在一个城市,但他不 ...

  8. TFS 2015 敏捷开发实践 – 在Kanban上运行一个Sprint

    前言:在 上一篇 TFS2015敏捷开发实践 中,我们给大家介绍了TFS2015中看板的基本使用和功能,这一篇中我们来看一个具体的场景,如何使用看板来运行一个sprint.Sprint是Scrum对迭 ...

  9. 敏捷测试模式之Scrum及其实践

    一.    敏捷开发模式简介 敏捷是近年来软件研发领域很火的一个词,采用敏捷开发模式的研发团队是越来越多了,尤其是敏捷模式中的Scrum更是佼佼者大行其道,这表明敏捷模式确有其好处,能给企业带来效率的 ...

  10. TFS 2015 敏捷开发实践 – 看板的使用

    看板在现代应用开发过程中使用非常广泛,不管是使用传统的瀑布式开发还是敏捷开发,都可以使用看板管理.因为看板拥有简单的管理方法,直观的显示方式,所以很多软件开发团队选择使用看板进行软件开发管理.本文不在 ...

随机推荐

  1. 一个非常适合IT团队的在线API文档、技术文档工具 (ShowDoc)

    在逸橙呆了不到两年,开发时后端都有开发接口API,来到数库,好多后端开发和前端沟通是还是发doc文档,很不方便,我向cto反应,自己找到这个,老乡田雷(php,隔壁村的)也用过,可能某些原因选择其他的 ...

  2. js 中class选择器,addClass,removeClass,hasClass,toggleClass,getByClass

    <!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...

  3. global 全局变量 nonlocal 局部变量

    # x= # def func(): # x= # # func() # print(x) # x=[] # def func(): # x.append() # x.append() # x.app ...

  4. Spring框架基本代码

    1.准备阶段: 2.基本引入: 接口: package com.xk.spring.kp01_hello; public interface IHello { public void nice(); ...

  5. Java实现将数字转为大写汉字

    public class Int2Big { static String int2big(int src) { final String num[] = {"零", "壹 ...

  6. Android : 代码多维度管理(产品风味) - flavorDimensions & productFlavors

    一.关于配置产品风味 Android studio 升级到3.0之后,gradle增加了多维度管理配置,便于同一个项目中创建应用的不同版本,分别管理依赖项并签署配置.创建产品风味与创建构建类型类似:只 ...

  7. git相关知识点

    git add 和 git stage 有什么区别: 工作区(Working Directory).暂存区(Stage)和历史记录区(History)以及转换关系不能少: git stage 是 gi ...

  8. 小波学习之一(单层一维离散小波变换DWT的Mallat算法C++和MATLAB实现) ---转载

      1 Mallat算法 离散序列的Mallat算法分解公式如下: 其中,H(n).G(n)分别表示所选取的小波函数对应的低通和高通滤波器的抽头系数序列. 从Mallat算法的分解原理可知,分解后的序 ...

  9. PMS5003ST+Arduino Nano OLED屏显示

    整合OLED显示和PMS5003报数 #include <Arduino.h> #include <pms.h> /////////////////////////////// ...

  10. Nginx日志和http模块相关变量

    $arg_PARAMETER #HTTP 请求中某个参数的值,如/index.php?site=www.ttlsa.com,可以用$arg_site 取得 www.ttlsa.com 这个值. $ar ...