2019年11月29日

C# 与 C++,语法差别有多小-其他2

摘要: 1. 内存分配 C++:指针在堆区(new),定义在栈区 C#: 对象在堆区,值在栈区。不允许不通过new在构造对象 2.变量 C++: char 1个字节 ascii C#: char 2个字节 unicode 3.运算符 C++: ++只能用于整数 C#:++可以用于浮点 python:我们没有 阅读全文

posted @ 2019-11-29 12:28 shoutcharter 阅读(170) 评论(0) 推荐(0) 编辑

C# 与 C++,语法差别有多小-其他1

只有注册用户登录后才能阅读该文。 阅读全文

posted @ 2019-11-29 12:10 shoutcharter 阅读(1) 评论(0) 推荐(0) 编辑

2019年11月28日

link

摘要: http://93.174.95.27/search.php?req=C%23+net+practical&open=0&res=25&view=simple&phrase=1&column=def http://www.phrasebank.manchester.ac.uk/introducing 阅读全文

posted @ 2019-11-28 18:22 shoutcharter 阅读(101) 评论(0) 推荐(0) 编辑

C# 与 C++,语法差别有多小-第三章 C++数据类型 第一部分

摘要: 一,数据类型 C++: char int short long float double, unsigned long double(128位,19位有效数字), wchar_t, 浮点型文字常量在缺省情况下被认为是 double 型,单精度文字s常量 由值后面的 f 或 F 来标示, L'a' 这 阅读全文

posted @ 2019-11-28 15:41 shoutcharter 阅读(230) 评论(0) 推荐(0) 编辑

C# 与 C++,语法差别有多小-第二章 C++浏览

摘要: (一)动态内存分配和指针 C++:new 和 delete int *arr = new int[ 4 ]; C#:只有new,delete是GC的事情 int[] arr = new int[100]; (二)基于对象的设计 2.1 类定义 C++: class classname { publi 阅读全文

posted @ 2019-11-28 15:34 shoutcharter 阅读(166) 评论(0) 推荐(0) 编辑

IEnumerator和IEnumerable详解

摘要: https://www.cnblogs.com/cjm123/p/8671783.html 5 代码达到了遍历效果,但是在用foreach遍历时,IEnumerator和IEnumerable究竟是如何运行的,我们可以通过增加增加日志可以直观的看到原因。 输出结果:GetIEnumeratorMov 阅读全文

posted @ 2019-11-28 12:12 shoutcharter 阅读(202) 评论(0) 推荐(0) 编辑

Object and Collection Initializers (C# Programming Guide) 类初始化

摘要: public class Cat { // Auto-implemented properties. public int Age { get; set; } public string Name { get; set; } public Cat() { } public Cat(string na 阅读全文

posted @ 2019-11-28 11:48 shoutcharter 阅读(130) 评论(0) 推荐(0) 编辑

[C#]浅谈协变与逆变

摘要: 说白了,就是为了让泛型也能搞工厂模式。 显然第二行的object到string是非类型安全的,那为什么第四行的object到string就是类型安全的呢?结合上一个方法体的示例,来看这段代码: 第一行貌似是把IList转换成了List,但是实际上是这样的:第六行传入的实参是一个List,进入方法体, 阅读全文

posted @ 2019-11-28 10:51 shoutcharter 阅读(159) 评论(0) 推荐(0) 编辑

action function

摘要: Action委托具有Action<T>、Action<T1,T2>、Action<T1,T2,T3>……Action<T1,……T16>多达16个的重载,其中传入参数均采用泛型中的类型参数T,涵盖了几乎所有可能存在的无返回值的委托类型。Func则具有Func<TResult>、Func<T,Tres 阅读全文

posted @ 2019-11-28 09:50 shoutcharter 阅读(136) 评论(0) 推荐(0) 编辑

delegate operator (C# reference) and => operator (C# reference)

摘要: The delegate operator creates an anonymous method that can be converted to a delegate type: C#CopyRun Note Beginning with C# 3, lambda expressions pro 阅读全文

posted @ 2019-11-28 08:38 shoutcharter 阅读(153) 评论(0) 推荐(0) 编辑

导航