
c#-函数式编程
c#-函数式编程
科学的发展-只不过是读大自然写的代码
科学的发展-只不过是读大自然写的代码
展开
-
c#-元组
代码using System;namespace ConsoleApp7{ public class A { public override string ToString() { return "a to string"; } } class Program { sta...原创 2019-07-09 16:40:53 · 528 阅读 · 0 评论 -
c#-运算符-概要说明举例
1 说明运算符 符号 别名 说明 一类 ?: 条件运算 表达式?表达式为true返回的结果:表达式为false返回的结果 check,uncheck 溢出异常运算符 check:有溢出抛出异常uncheck:有溢出不抛出异常 ? ?[] 空值条件运算符 int? a=null ?? 空合并运算符 int?...原创 2020-02-11 14:23:38 · 197 阅读 · 0 评论 -
c#-运算符-可靠运算符/空合并运算符
1 概要1.1?可空运算符:int? a = null1.2?? 空合并运算符 int? c = a??b;2 举例2.1 运行结果Hello World!null??1:1null??null:(int)fun(mull, 1):1(int?)fun(null, null):2.2 代码using System;namespace 运算符...原创 2020-02-11 11:13:18 · 164 阅读 · 0 评论 -
c#-运算符-溢出ckeck运算符
1 溢出check1.1 运行结果Hello World!System.OverflowException: Arithmetic operation resulted in an overflow. at 运算符.溢出check运算符.main() in D:\projects\运算符\运算符\Program.cs:line 481.2 代码using Syste...原创 2020-02-11 10:26:27 · 818 阅读 · 0 评论 -
c#-运算符-条件运算符
1概要表达式?表达式为true的返回值:表达式为false的返回值2举例2.1 运行结果Hello World!a ? b : c return:3fun(a, b, c) return:32.2 代码using System;namespace 运算符{ class Program { static void Main(...原创 2020-02-11 10:01:30 · 463 阅读 · 0 评论 -
c#-lambda
using System;// c#-lambdanamespace ConsoleApp12{ class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); int a = 5; ...原创 2019-07-10 10:45:24 · 543 阅读 · 0 评论 -
c#-运算符-自定义索引运算符
using System;using System.Collections.Generic;using System.Linq;//c#-运算符-自定义索引运算符namespace ConsoleApp11{ class A { public A(int b) { B = b; } public int B...原创 2019-07-10 10:16:06 · 966 阅读 · 0 评论 -
c#-运算符重载-等号运算符
using System;// c#-运算符重载-等号运算符namespace ConsoleApp10{ class A { public A(int b) => this.b = b; public int b; public static bool operator ==(A left, A right) { ...原创 2019-07-10 09:47:18 · 2926 阅读 · 0 评论 -
c#-运算符-空合并运算符(??)
using System;// c#-运算符-空合并运算符namespace ConsoleApp9{ class Program { static void Main(string[] args) { Console.WriteLine("空合并运算符"); int? a = null; ...原创 2019-07-10 09:33:00 · 423 阅读 · 0 评论 -
c#-运算符-空值条件运算符
using System;// c#-运算符-空值条件运算符namespace ConsoleApp8{ class A { string b = "test str"; public string B { get { return b; } set { b = value; } } ...原创 2019-07-10 09:18:25 · 1009 阅读 · 0 评论 -
c#-扩展方法
代码using System;namespace ConsoleApp3{ class A { int a = 5; } public static class AExtension { public static int fun() { return 5; } } p...原创 2019-07-09 12:58:38 · 216 阅读 · 0 评论 -
c#-表达式体(c#7)
代码using System;namespace ConsoleApp2{ //具有表达式体的属性访问器 class A { int a; public int B{ set => a = value; get => a; } } //表达式体属性 ...原创 2019-07-09 12:37:37 · 608 阅读 · 0 评论