下面列出了迄今为止你应该了解的关于C#博客的2000件事的全部帖子。express 帖子总数= 1,219编程 大会windows
基本visual-studio-code
- #1 - Main()签名的样子
- #2 - 最小的C#程序
- #3 - 谁设计了C#?
- #4 - C#与Java有什么不一样?
- #5 - C#与VB.NET有何不一样?
- #6 - 一个更小的C#程序
- #8 - Main()函数能够返回一个int
- #9 - Main()不该该公开
- #10 - Main()的返回值在Windows中设置ERRORLEVEL变量
- #12 - 读取命令行参数
- #18 - 什么是标识符?
- #19 - 上下文关键字
- #20 - 文学
- #21 - 布尔文字
- #22 - 整数文字
- #23 - 真正的文学
- #24 - 字符文字
- #26 - Null Literal
- #27 - 表达式,运算符和操做数
- #28 - 运营商优先权
- #29 - 评论
- #35 - 声明变量
- #36 - 可变初始化和肯定分配
- #45 - 班级的静态成员
- #46 - 只有一个静态数据副本
- #52 - 算术运算符
- #53 - 模数
- #54 - 增量和减量运算符
- #55 - 截断中的整数除法结果
- #56 - 将Float转换为Int时如何舍入
- #67 - 参考类型相等的默认行为
- #72 - 十六进制数
- #73 - 按位运算符
- #74 - 转移运算符
- #75 - 转移时的新比特
- #77 - 特殊浮点值
- #78 - 检查特殊浮点值
- #79 - NaN的平等检查
- #83 - .NET中的JIT编译
- #84 - 将元数据视为源代码
- #85 - C#程序的通常结构
- #86 - 平等和不平等运算符
- #87 - 关系运算符
- #88 - 条件运算符
- #89 - 否认运营商
- #90 - 更复杂的逻辑表达式
- #91 - 条件运算符能够进行短路评估
- #92 - 三元条件运算符
- #110 - 将算术运算符与赋值运算符组合
- #111 - 将逻辑或移位运算符与赋值运算符组合在一块儿
- #117 - 使用#define定义符号
- #118 - 禁用特定编译器警告
- #181 - C#强类型
- #182 - C#是(大部分)强类型
- #183 - 使用var告诉编译器弄清楚类型
- #184 - 对象类型的做弊类型安全
- #185 - 堆和堆栈
- #186 - 堆上的值类型
- #187 - 一切都是对象
- #188 - 对象在堆中,对象的引用在堆栈中
- #189 - 基于堆栈的对象的内存管理
- #190 - 基于堆的对象的内存管理
- #199 - 您没法显式删除基于堆的对象
- #200 - 静态数据和常量存储在堆上
- #201 - 你能够在C#中泄漏内存
- #202 - 对象中的全部字段都自动初始化
- #204 - 关于使用隐式类型变量的三条规则
- #205 - 用户可定义的五种类型
- #206 - 值类型不能表示空值
- #207 - 可空类型
- #208 - 你可使任何值类型为Nullable
- #209 - 为何你想在变量中存储空值
- #222 - C#发音为“C Sharp”
- #223 - 为您的项目启用代码分析
- #224 - 代码分析会遇到问题的一个例子
- #225 - 使用FxCop进行自由静态分析
- #371 - 表明基础知识
- #372 - 表明们有什么好处
- #373 - 表明能够参考多种方法
- #374 - 自定义委托派生自System.MulticastDelegate
- #375 - 使用GetInvocationList获取单个表明的列表
- #376 - 在委托调用期间发生异常时会发生什么
- #377 - 确保使用GetInvocationList调用全部代理的方法
- #385 - 委托实例能够引用实例和静态方法
- #391 - 将代理实例做为参数传递
- #401 - 每一个对象都继承一个等于方法
- #402 - 价值平等与参考平等
- #403 - 参考类型的等于方法与==运算符
- #404 - 等于方法与==运算符的值类型
- #406 - 覆盖Equals方法
- #407 - 为何在覆盖等于时应该覆盖GetHashCode
- #411 - 覆盖值类型的等于方法
- #413 - 使用Object.ReferenceEquals检查引用相等性
- #417 - 为价值平等提供特定类型的等价方法
- #418 - 实现IComparable接口
- #420 - 实施价值平等和IComparable的洗衣清单
- #421 - 价值平等和IComparable示例
- #424 - 垃圾收集器
- #425 - 不肯定性破坏和对象终结
- #426 - 使用析构函数释放非托管资源
- #427 - Finalizer Gotchas
- #428 - 终结器应始终调用其基类的终结器
- #429 - 使用Dispose Pattern进行肯定性破坏
- #430 - 处理模式示例
- #431 - using语句自动调用Dispose方法
- #432 - 在using语句中初始化多个对象
- #467 - 元数据
- #468 - 容许向程序元素添加元数据的属性
- #469 - 将属性附加到类型成员
- #470 - 定义本身的自定义属性
- #471 - 使用反射读取属性的值
- #472 - 属性能够附加到各类元素上
- #473 - 指定能够应用自定义属性的元素类型
- #475 - 在字符串文字中显示的注释被视为字符串的一部分
- #476 - 不要在标识符中使用Unicode转义序列
- #499 - 条件编译符号定义或未定义
- #500 - #define和#undef必须位于文件顶部
- #501 - C ++中的#define和C#之间的差别
- #502 - #define和#undef范围
- #503 - 使用#if / #endif指令有条件地编译代码
- #504 - 使用#else指令
- #505 - 使用#elif指令
- #506 - 在#if和#elif指令中使用表达式
- #507 - 您能够在#if Block中#define其余符号
- #508 - 使用#error和#warning指令
- #509 - 使用#pragma warning Directive禁用编译时警告
- #514 - 运营商优先顺序的例子
- #515 - 二元运算符是左关联的
- #516 - 做业运算符是右关联的
- #518 - 分割跨多个文件的类的实现
- #521 - 命名空间帮助组织类型
- #522 - 类型的彻底限定名称包括命名空间
- #523 - 使用指令容许省略命名空间
- #524 - 命名空间中的全部类型必须是惟一的
- #525 - 命名空间能够嵌套
- #526 - 使用语句能够别名嵌套命名空间
- #527 - 使用点表示法定义嵌套命名空间
- #529 - using指令能够为命名空间建立别名
- #530 - 命名空间与程序集
- #531 - 命名命名空间的最佳实践
- #532 - 使用来自不一样程序集的相同命名类型
- #533 - 外部别名的替表明示法
- #535 - 建立通用结构
- #542 - 命名类型参数的约定
- #543 - 能够对通用类型对象执行的操做
- #544 - 指定类型参数的约束
- #545 - 为多个类型参数指定约束
- #550 - 匿名方法不须要正式参数
- #551 - 添加到调用列表时使用匿名方法
- #552 - 匿名方法能够访问声明它们的局部变量
- #583 - 您没法修改foreach循环中的迭代器变量
- #640 - 您没法使用的方法名称
- #659 - 获取有关对象类型的信息
- #660 - typeof运算符获取有关类型的信息
- #661 - 每一个对象都有一个ToString方法
- #662 - 覆盖自定义类型的ToString方法
- #664 - 物理内存与虚拟内存
- #665 - 最大虚拟内存量
- #666 - 使用性能计数器查看.NET内存使用状况
- #667 - 垃圾收集器运行时.NET内存性能计数器更新
- #668 - GetTotalMemory表示您分配了多少内存
- #673 - 使用Statement中使用的类型必须实现IDisposable
- #689 - 参考和对象
- #707 - 程序中的多个类能够包含主要方法
- #709 - 一种方法能够从新定义父类中存在的名称
- #710 - 块中声明的变量在块外不可见
- #711 - 全局命名空间
- #712 - 辅助功能摘要
- #713 - 明确声明可访问性
- #714 - 内部类型中公共方法的可访问性
- #718 - 范围
- #721 - 本地变量声明能够隐藏类成员
- #722 - 本地变量声明可能没法始终隐藏类成员
- #724 - 类型的彻底限定名称
- #730 - 在迭代前使用foreach语句检查null
- #732 - 毁灭与收藏
- #733 - 如何判断对象是否收集了垃圾
- #734 - 访问经过WeakReference引用的原始对象
- #735 - 不要相信WeakReference.IsAlive若是它返回true
- #736 - 垃圾收集后,WeakReference的目标将为null
- #738 - 你不该该明确强制垃圾收集
- #740 - 短时间与长期弱参考
- #771 - System.Object成员摘要
- #803 - 您可能使用var关键字时的状况
- #804 - 使用var关键字时的权衡
- #805 - 自定义使用var关键字的示例
- #806 - 强制使用var关键字的示例
- #846 - 调用堆栈跟踪已调用的方法
- #847 - 调用堆栈的工做原理
- #921 - 显式建立但自动销毁的对象
- #922 - 发布对象引用的方法
- #923 - 一个对象不会被删除,由于它被解除引用
- #924 - 您一般不该该担忧内存管理问题
- #940 - 应用程序关闭时调用终结器
- #941 - 检查对象是不是一次性的
- #949 - 哪一个版本的C#是什么
- #950 - C#具备统一类型系统
- #951 - 不是每种类型都来自对象
- #952 - 类型安全
- #953 - 静态打字与动态打字
- #954 - 静态打字与强类型
- #955 - C#是一种托管语言
- #956 - 公共语言基础结构(CLI)
- #957 - 命名包含C#代码的文件
- #958 - 标识符的命名约定
- #959 - 不要在标识符的开头使用双下划线
- #960 - 命名类的约定
- #961 - 检索命令行和可执行文件的路径
- #962 - 语句能够跨越多行
- #963 - 使用大括号括起一块语句
- #964 - 在语句块中声明变量
- #965 - 缩进代码以提升可读性
- #966 - Visual Studio代码编辑器帮助缩进
- #967 - 为变量赋值
- #968 - 从变量中读取值
- #969 - 建立一个简单的控制台应用程序
- #971 - 从控制台读取输入线
- #972 - 从控制台读取击键
- #973 - 复合格式字符串中的格式项能够按任意顺序排列
- #974 - 写得很好的代码包括写得好的评论
- #975 - 评论您的准则的指南
- #981 - C#关键字的完整列表
- #985 - 为何它对条件运算符进行短路评估颇有用
- #987 - 使用指令能够为类型建立别名
- #988 - 使用global显式引用命名空间
- #989 - 将数字格式化为十六进制
- #990 - 将十六进制字符串转换为数字数据
- #994 - Unicode基础知识
- #995 - Unicode代码点
- #996 - UTF-16编码,第一部分
- #997 - UTF-16编码,第二部分
- #998 - UTF-8编码
- #999 - UTF-16和UTF-8编码的一些例子
- #1,000 - UTF-8和ASCII
- #1,001 - 表明Unicode代理对
- #1,002 - 写入文件时指定字符编码
- #1,017 - 委托类型与委托实例
- #1,018 - 委托调用语法
- #1,019 - 向委托的调用列表添加方法的语法
- #1,020 - 从委托的调用列表中删除方法
- #1,021 - 表明的回报值会发生什么
- #1,022 - 如何使用全部代理实例的返回值
- #1,077 - 十进制数字系统
- #1,078 - 十六进制数字系统
- #1,079 - 二进制数字系统
- #1,080 - 二进制数字写为十六进制
- #1,081 - 比特,字节和半字节
- #1,082 - Big-endian和Little-endian
- #1,083 - 使用Visual Studio验证Little-Endianness
- #1,084 - 使用科学记数法表示数字
- #1,085 - 二进制浮点数
- #1,086 - 将十进制浮点数转换为二进制浮点数
- #1,087 - 使用科学记数法表示二进制浮点数
- #1,088 - 如何在.NET中存储32位浮点数,第一部分
- #1,089 - 如何在.NET中存储32位浮点数,第二部分
- #1,090 - 使用Visual Studio验证如何存储浮点数
- #1,091 - 次正规浮点数
- #1,092 - 正面和负面零点
- #1,093 - 如何存储正负零值
- #1,094 - 正面和负面无限
- #1,095 - 如何存储浮点无穷大值
- #1,096 - 浮点NaN值
- #1,097 - 如何在.NET中存储浮点数的摘要
- #1,098 - 浮点溢出
- #1,099 - 重载增量运算符
- #1,102 - 范围与宣言空间
- #1,103 - 块定义范围和声明空间
- #1,104 - 没法在嵌套块中从新声明变量
- #1,105 - 在方法中从新声明类级变量
- #1,112 - 如何在.NET中存储整数
- #1,113 - 使用二进制补码添加整数
- #1,127 - 在何处查找编译器警告号
- #1,128 - 禁用整个项目的编译时警告
- #1,149 - 通用委托类型
- #1,150 - 通用委托类型做为参数
- #1,151 - Func委托类型
- #1,152 - 行动表明类型
- #1,153 - 不一样的委托类型不兼容
- #1,154 - 分配给委托类型时的输入参数兼容性
- #1,155 - 分配给委托类型时的返回值兼容性
- #1,156 - 协方差和通用表明类型
- #1,157 - 逆变和通用表明类型
类设计模式
- #141 - 为自定义类型实现ICloneable
- #143 - 深度拷贝实现ICloneable的示例
- #144 - 使用序列化实现深度复制
- #226 - 类和对象
- #227 - 在堆上建立类的实例
- #228 - C#中使用类的面向对象编程
- #229 - 面向对象编程的核心原则
- #230 - 用户定义的类型是一等公民
- #231 - 在类中声明和使用实例字段
- #232 - 在类中声明和使用实例方法
- #233 - 从实例方法返回结果
- #234 - 多个返回语句
- #235 - void方法不须要return语句
- #236 - 从方法返回引用类型
- #237 - 从其中一个方法中引用类字段
- #238 - 从另外一种方法调用方法
- #239 - 本参考文献
- #240 - 类中的私有和公共实例数据
- #241 - 声明和使用私有实例方法
- #242 - 在类中声明和使用属性
- #243 - 属性获取和设置访问者
- #244 - 为属性定义Get Accessor
- #245 - 为属性定义Set Accessor
- #246 - 实现只读属性
- #247 - 实现只写属性
- #248 - 实现返回计算值的属性
- #249 - 使用get Accessor清理属性数据
- #250 - 使用set Accessor转换或验证属性数据
- #251 - 类属性支持封装原则
- #252 - 自动属性
- #253 - 实现只读自动属性
- #254 - 使用私有集访问器实现只读属性
- #255 - 静态字段与实例字段
- #256 - 使用静态字段
- #257 - 私人静态字段
- #258 - 初始化静态变量做为其声明的一部分
- #259 - 静态与实例属性
- #260 - 属性如何在封面下看
- #261 - 自动属性如何在封面下看
- #262 - 使用参数将数据传递给方法
- #263 - 方法的签名在其类型中必须是惟一的
- #285 - 班级成员概述
- #286 - 建立类的实例时调用构造函数
- #287 - 您没必要定义构造函数
- #288 - 将参数传递给构造函数
- #289 - 您能够定义多个构造函数
- #290 - 连接构造函数
- #291 - 若是定义任何构造函数,则无默认构造函数
- #292 - 静态构造函数初始化静态数据
- #293 - 您能够声明私有构造函数
- #294 - 让全部构造函数都是私有的,以防止建立对象
- #295 - 什么时候调用静态构造函数?
- #299 - Intellisense显示可用的构造函数
- #303 - 集体成员的可访问性
- #304 - 私人班级成员
- #305 - 公共级会员
- #306 - 受保护的班级成员
- #307 - 内部班级成员
- #308 - 受保护的内部班级成员
- #309 - 在派生类中访问受保护的成员
- #310 - 类中字段的可访问性
- #311 - 类中属性的可访问性
- #312 - 类中方法的可访问性
- #313 - 类中构造函数的可访问性
- #314 - 静态构造函数不容许访问修饰符
- #315 - 静态方法和属性的可访问性
- #322 - 类可访问性
- #323 - 通用类是类的模板
- #324 - 通用类能够有多个类型参数
- #325 - Intellisense理解通用类
- #326 - 通用类型与构造类型
- #329 - 一个类能够继承另外一个类的数据和行为
- #330 - 派生类不会继承构造函数
- #331 - 隐式地与显式地调用基类构造函数
- #332 - 每一个类都彻底属于一个类
- #333 - 类继承致使类的层次结构
- #334 - 基类变量能够引用派生类的实例
- #335 - 使用基类变量访问派生类
- #336 - 声明和使用只读字段
- #337 - 声明和使用静态只读字段
- #338 - 静态只读字段与常量
- #339 - 只读字段与只读属性
- #342 - 使用静态变量计算类的实例
- #343 - 使用新的关键字替换基类中的方法
- #344 - 基于声明的对象类型调用隐藏的基类成员
- #345 - 派生类中的方法默认隐藏基类方法
- #346 - 多态性
- #347 - 多态性的另外一个例子
- #348 - 虚方法支持多态性
- #349 - 虚拟和非虚拟方法之间的区别
- #350 - 多态行为所需的方法修饰符
- #351 - 抽象方法没有实现
- #352 - 您没法实例化抽象类
- #353 - 为何你能够定义一个抽象类
- #355 - 使用新的关键字替换基类中的属性
- #356 - 基于声明的对象类型使用隐藏的基类属性
- #357 - 派生类中的属性默认隐藏基类属性
- #358 - 虚拟属性支持多态性
- #359 - 虚拟和非虚拟属性之间的区别
- #360 - 多态行为所需的属性修饰符
- #361 - 抽象属性没有实现
- #362 - 定义索引器
- #363 - 索引器能够同时获取和设置访问者
- #364 - 定义参数为枚举类型的索引器
- #365 - 重载索引器
- #366 - 使用多个参数定义索引器
- #517 - 静态类
- #534 - 泛型有什么用?
- #546 - 为同一类型参数指定多个约束
- #547 - 能够做为类型参数约束的东西
- #548 - 类型参数约束不超过一个类
- #567 - 更普遍与更窄的类型
- #570 - 参考类型的分配兼容性
- #590 - 构造函数中的可选参数
- #601 - 类能够从父类继承并实现接口
- #602 - 初始化类中的字段
- #603 - 使用常量能够强制从新编译
- #609 - 省略同一类中静态成员的类名
- #610 - 财产中的懒惰评估获取访问者
- #614 - 子类可访问性
- #615 - 您没法删除基类成员
- #616 - 基类必须知道是否须要多态性
- #617 - 在基类中调用方法的最简单方法
- #618 - 使用基本关键字在基类中调用方法
- #619 - 在基类中调用构造函数
- #620 - 从不一样程序集中的类继承
- #621 - 密封类以防止继承
- #622 - 密封与非密封
- #623 - 在另外一种类型中定义一种类型
- #624 - 嵌套类的可访问性
- #625 - 使用点表示法引用嵌套类型
- #626 - 嵌套类型选项
- #627 - 结构或类中嵌套类型的可访问性
- #628 - 为何你可能会建立一个嵌套类型
- #629 - 嵌套类型具备对父级成员的彻底访问权限
- #630 - 嵌套类型能够隐藏外类中的成员
- #631 - 代码生成工具和部分类
- #639 - 静态类能够包含嵌套的非静态类
- #648 - 使用对象初始化器
- #649 - 建立匿名类型
- #655 - 使用对象初始化程序仅初始化某些属性
- #656 - 嵌套对象初始化器
- #669 - 经过调用方法初始化字段
- #670 - 静态与实例初始化
- #671 - 基类构造函数能够调用虚方法
- #675 - 多态行为须要虚拟/覆盖组合
- #676 - 重写的方法能够本身被覆盖
- #677 - 没法覆盖标记为新修改器的方法
- #678 - 没法覆盖密封方法
- #679 - 使用虚方法隐藏继承的方法
- #680 - 虚拟修改器组合
- #681 - 避免使用新关键字隐藏方法
- #682 - 新关键字的真正缘由
- #683 - 对象能够多态化的两种方式
- #684 - 隐藏的基类成员并不是真正隐藏
- #685 - 继承能够破坏封装
- #686 - 继承与遏制
- #687 - 遏制的一个例子
- #688 - 聚合,组成和遏制
- #690 - 使用此关键字区分字段和参数
- #692 - 构造函数中可选参数的两种方法
- #693 - 构造函数中的命名参数容许最大的灵活性
- #694 - 链式构造函数的事件序列
- #696 - 使用静态属性计算实例
- #697 - 经过使用访问修饰符管理封装
- #698 - 类型成员是隐性私人的
- #699 - 类型是隐含内部的
- #700 - 使用set Accessor强制进行套管
- #701 - 在设置的访问者中集中业务规则逻辑
- #702 - 自动属性必须定义get和set Accessors
- #703 - 对象初始化器容许设置字段或属性
- #704 - 在任何构造函数中使用对象初始化程序
- #708 - 名称在宣言空间内必须是惟一的
- #715 - 私人会员在派生类中不可见
- #716 - 派生类如何访问受保护的成员
- #717 - 类成员不能比他们的类型更容易访问
- #719 - A类中声明的位置可有可无
- #720 - 方法中声明的位置很重要
- #723 - 派生类中可能没法看到子类中的新方法
- #737 - 什么时候实施终结器
- #739 - 避免在完成后访问对象
- #741 - 继承的基础
- #742 - 一个简单的继承示例
- #744 - 继承的目的
- #751 - 仅部分保留封装的继承
- #752 - C#不支持多重继承
- #753 - 隐式向上转换为基类引用
- #754 - 向下转换为对派生类的引用
- #768 - 什么时候调用基类的构造函数
- #769 - 模式 - 覆盖它时调用基类方法
- #783 - 什么时候建立静态类
- #784 - 什么时候不使用静态类
- #787 - 避免在类中使用公共字段
- #788 - 支持字段存储属性的数据
- #790 - 属性获取和设置访问者能够有不一样的访问修饰符
- #791 - 属性不是变量
- #795 - 建立不可变类的规则
- #796 - 属性访问器的默承认访问性
- #797 - 设置属性访问器的可访问性
- #798 - 您没法覆盖不可访问的访问者
- #800 - 接口中的属性可能包含一个或两个访问器
- #801 - 简单不可变类的一个例子
- #817 - 静态构造函数引起异常时会发生什么
- #818 - 实例构造函数引起异常时会发生什么
- #819 - 私有构造函数可能会阻止继承
- #820 - 受保护的构造函数容许子类建立实例
- #824 - 复制构造函数制做现有对象的副本
- #825 - 浅拷贝
- #826 - 深拷贝
- #827 - 使用复制构造函数制做深层复制
- #828 - 实现复制构造函数和ICloneable
- #829 - 添加注释以指示浅层与深层复制
- #830 - ICloneable的问题
- #831 - 在派生类中实现复制构造函数
- #832 - 调用终结器的顺序
- #1,023 - 在执行构造函数以前初始化字段
- #1,024 - 将内部成员公开给另外一个大会
- #1,027 - 类型参数与通用类中的类型参数
- #1,028 - 通用类型与通用方法
- #1,029 - 如何在通用类型中定义构造函数
- #1,030 - 要求通用类型参数从指定的类派生
- #1,031 - 要求通用类型参数实现接口
- #1,032 - 要求通用类型参数为参考或值类型
- #1,033 - 要求通用类型参数具备无参数构造函数
- #1,034 - 使一个类型参数取决于另外一个
- #1,035 - 类型参数约束的摘要
- #1,036 - 指定多种类型参数约束
- #1,037 - 为多个类型参数指定类型参数约束
- #1,039 - 从通用类派生
- #1,040 - 从构造类型派生
- #1,041 - 从通用类派生时添加新类型参数
- #1,042 - 从自我参照构造类型派生,第一部分
- #1,043 - 从自我参照构造类型派生,第二部分
- #1,044 - 静态数据在通用类型中的表现方式
- #1,070 - 能够编译通用类型
- #1,134 - 使用“of of”术语来表示泛型
- #1,135 - 重载通用类
- #1,137 - 非通用类中的通用方法
- #1,138 - 通用方法中的类型参数能够被约束
- #1,139 - 通用类型中对象比较的问题
- #1,140 - 比较通用类型中的参考类型对象
- #1,141 - 即便可用于类型化参数的过载,也使用参考等式
- #1,142 - 使用EqualityComparer比较通用类型中的对象
- #1,143 - 在通用类型中实现IEquatable
- #1,144 - 获取有关通用类型的类型信息
- #1,145 - 对通用类型参数使用反射
- #1,146 - 泛型不支持协方差
- #1,147 - 为何泛型不支持协方差
- #1,148 - 什么时候使用通用协变接口
集合数组
数据类型浏览器
- #30 - 类型,变量,值,实例
- #31 - 价值类型和参考类型
- #32 - 内置类型
- #34 - 对象类型
- #37 - 全部值类型都有默认构造函数
- #38 - 数据类型层次结构
- #39 - 数值类型的MinValue / MaxValue
- #40 - TrueString和FalseString
- #41 - 实例化参考类型
- #42 - 与对象交互
- #43 - 对象在堆上实例化
- #44 - 对同一对象的多个引用
- #47 - 经过铸造进行数字转换
- #48 - 显式强制转换如何失败
- #49 - 什么时候使用十进制类型
- #50 - System.Char的静态方法
- #51 - Float Literals必须使用f后缀
- #57 - 整数操做溢出
- #58 - 使用Checked Operator生成整数溢出的异常
- #59 - 使用未经检查的关键字来避免溢出异常
- #76 - 小整数的算术运算
- #80 - 使用十进制类型进行货币计算
- #81 - DateTime和TimeSpan类型
- #82 - 一些常见的DateTime和TimeSpan函数
- #93 - 字符文字中的转义序列
- #94 - 在字符和数字类型之间转换
- #107 - 定义和使用结构
- #108 - 为Struct定义构造函数
- #109 - 定义和使用枚举
- #119 - 阵列
- #120 - 数组声明和实例化
- #121 - 数组初始化
- #122 - 数组能够包含任何类型的对象
- #123 - 在数组中存储任意对象
- #124 - 声明和实例化多维数组
- #125 - 初始化多维数组
- #126 - 初始化参考类型对象的数组
- #127 - 声明和实例化锯齿状数组
- #128 - 访问锯齿状数组中的元素
- #129 - 初始化锯齿状数组
- #130 - 数组元素的默认值
- #131 - Arrays派生自System.Array
- #132 - 多维和锯齿状的阵列
- #133 - 数组的长度是固定的
- #134 - 对一维数组进行排序
- #135 - 实现IComparable以容许排序自定义类型
- #136 - 根据键数组对值数组进行排序
- #137 - 使用独立的比较器方法对阵列进行排序
- #138 - 搜索已排序的数组
- #139 - 使用Array.Clone方法制做数组的浅拷贝
- #140 - 使用对象的克隆方法制做数组的深层副本
- #142 - 为深拷贝实施ICloneable
- #145 - 使用Array.Find搜索未排序的数组
- #146 - 使用Array.FindAll查找数组中的一组匹配元素
- #147 - 获取数字数组的平均值
- #148 - 获取自定义对象数组的平均值
- #149 - 使用IEnumerable.Aggregate基于数组中的全部元素执行计算
- #150 - 能够应用于数字数组的其余聚合函数
- #151 - 肯定数组是否包含特定元素
- #152 - 使用Distinct()方法删除重复数组条目
- #153 - 返回匹配特定标准的数组元素子集
- #154 - 使用无效数组索引致使异常被抛出
- #155 - 使用foreach语句迭代数组
- #156 - 在foreach循环中使用break并继续
- #191 - 更改枚举的基础类型
- #192 - 为枚举成员使用非默认常量值
- #193 - 枚举类型的ToString方法显示成员的名称
- #194 - 将一组布尔值存储为位
- #195 - 使用枚举类型存储一组标志
- #196 - 在基于标志的枚举类型上使用ToString()方法
- #197 - 检查存在标志的枚举值
- #198 - 设置标志组合的枚举值
- #203 - 始终具备0值枚举常数的良好实践
- #210 - 检查能够为空的对象是否有值
- #211 - 使用Null-Coalescing(??)运算符
- #212 - 在同一表达式中使用多个Null-Coalescing(??)运算符
- #213 - 使用Null-Coalescing(??)运算符时的最终操做数
- #214 - 使用带引用类型的Null-Coalescing(??)运算符
- #215 - 使用具备自定义可空类型的Null-Coalescing(??)运算符
- #216 - Null-Coalescing(??)运算符等效于GetValueOrDefault方法
- #217 - T?至关于Nullable <T>
- #218 - 在堆积经过拳击中存储值类型对象
- #219 - 取消装箱装箱物品
- #220 - 拳击能够自动发生
- #221 - 取消装箱时,您必须彻底匹配原始类型
- #280 - 隐式类型数组
- #296 - 在使用结构以前,必须为全部字段赋值
- #297 - 初始化结构内容的三种不一样方法
- #298 - 结构能够有几个构造函数
- #316 - 声明和使用常量
- #317 - 常数能够是班级成员
- #318 - 您不能在常量上使用静态修改器
- #319 - 使用表达式初始化常量
- #320 - 参考类型常量的常量表达式必须为空
- #321 - 常量的可访问性
- #327 - 为新变量分配结构进行复制
- #328 - 复制结构不会复制基础参考类型
- #367 - 迭代枚举类型的全部可能值
- #433 - 全部结构都继承自System.ValueType
- #457 - 在枚举及其基础类型之间转换
- #458 - 枚举和底层类型之间转换时的错误
- #459 - 为枚举分配不一样类型的值
- #460 - 从字符串转换为枚举类型
- #461 - 枚举元素不须要是连续的
- #462 - 枚举类型中的重复枚举器
- #463 - 枚举值能够是任何常量表达式
- #464 - 在运行时获取枚举的基础类型
- #465 - 转储枚举类型的全部名称和值
- #466 - 仅显式分配一些枚举值
- #477 - 字符文字的转义序列的完整列表
- #510 - 在同一行上声明多个局部变量
- #519 - 结构和类之间的差别
- #520 - 在结构和类之间进行选择
- #566 - 可空类型的隐式转换
- #568 - 数组协方差
- #569 - 做业兼容性
- #571 - 编程语言中的协方差
- #572 - 为何数组协方差称为协方差
- #573 - 数组协方差不适用于值类型
- #574 - 阵列协方差的问题
- #581 - 拳击和拆箱可空类型
- #582 - 使用as运算符将其置为可空类型
- #596 - 隐式类型数组和最佳类型推断
- #598 - 清除数组或数组的子集
- #599 - 将数组复制到另外一个数组
- #600 - 反转数组中的元素
- #611 - 结构中成员的可访问性
- #641 - 在结构中使用此关键字
- #642 - 在结构中从新分配此指针
- #643 - 结构的构造函数必须初始化全部数据成员
- #644 - 连接结构体构造函数
- #645 - 您能够连接到结构的默认构造函数
- #646 - 值类型没有终结器
- #650 - 建立一个匿名类型的对象数组
- #651 - 将匿名类型的对象传递给方法
- #652 - 在匿名类型声明中使用表达式和变量
- #653 - 投影初始化器
- #654 - 您不能直接使用匿名类型
- #657 - 拳击制做一个物体的副本
- #658 - IL中的拳击和拆箱效果如何
- #767 - 结构被隐式密封
- #775 - 复制一个匿名类型的对象数组
- #776 - 声明和使用Nullable结构
- #777 - 结构在用做属性时不可变
- #778 - 结构在集合中使用时不可变
- #779 - 修改元素的结构中的方法多是危险的
- #780 - 不可变结构的案例
- #781 - 结构能够实现接口
- #782 - 您能够在没有新关键字的状况下建立结构的实例
- #789 - 将常数分组为本身的类
- #833 - 匿名对象初始化器的一些示例
- #834 - 使用通用列表存储对象集合
- #835 - 通用列表能够存储值类型或参考类型的对象
- #836 - 使用对象初始化程序初始化通用列表
- #837 - Collection Initializers中的Object Initializers
- #838 - 做为参数的对象和集合初始值设定项
- #839 - 匿名类型限制
- #840 - 使用匿名类型做为对象的只读子集
- #982 - 枚举类型能够存储最多32个标志
- #983 - 使用BitArray存储大量布尔值
- #991 - 使用往返格式说明符
- #992 - System.Char数据类型
- #993 - 角色的一些例子
- #1,012 - 阵列声明,实例化和初始化的选项
- #1,013 - 默认运算符返回默认值
- #1,014 - 在通用类中使用默认运算符
- #1,015 - 将字节数组渲染为一系列十六进制字符
- #1,016 - 检索数组的长度
- #1,025 - 在枚举类型之间转换
- #1,026 - 检查已标记的枚举类型的有效性
- #1,045 - 从可空类型分配时的隐式转换
- #1,046 - 隐式与显式转换
- #1,047 - 隐式身份转换
- #1,048 - 签名与无符号之间没有隐式转换
- #1,049 - 隐式数字转换的完整列表
- #1,050 - 可空类型之间的隐式转换
- #1,051 - 隐式参考转换
- #1,052 - 拳击是一种隐含的转换
- #1,053 - 类型动态的隐式转换
- #1,054 - 常量表达式的隐式转换
- #1,055 - 定义你本身的隐含转换
- #1,056 - 引用类型之间的自定义隐式转换
- #1,057 - 自定义显式转换
- #1,058 - 两个方向的自定义隐式转换
- #1,059 - 从数字转换为枚举类型
- #1,060 - 可空类型之间的显式转换
- #1,061 - 显式引用转换
- #1,062 - 取消装箱转化
- #1,063 - 显式转换和类型参数
- #1,064 - 没法显式转换类型参数
- #1,065 - 数组协方差不起做用的状况
- #1,066 - 在通用接口上约束类型参数
- #1,076 - char类型的隐式数字转换
- #1,111 - 将整数转换为不一样基数中的字符串
- #1,198 - 使用具备可空类型的运算符
- #1,199 - 具备可空类型的平等和不等式
调试安全
列举app
活动
例外
输入输出
接口
记忆
方法
- #264 - 默认状况下,参数按值传递
- #265 - 按值传递引用类型
- #266 - 您没法阻止方法更改引用类型的内容
- #267 - 使用输出参数从方法传回数据
- #268 - 在从方法返回以前,必须设置全部输出参数的值
- #269 - 在输入/输出参数上使用ref修饰符
- #270 - 经过引用传递引用类型
- #271 - 传递参考类型做为输出参数
- #272 - ref和out参数之间的差别
- #273 - 参数修饰符摘要
- #274 - 若是方法仅由ref和out Modifiers不一样,则没法重载
- #275 - 将结构传递给Method
- #276 - 经过引用传递结构
- #277 - 将数组传递给方法
- #278 - 经过引用传递数组
- #279 - 将多维数组传递给方法
- #281 - 在类中声明和使用静态方法
- #282 - 建立私有静态方法
- #283 - 实例方法能够调用静态方法
- #284 - 静态方法能够调用实例方法
- #340 - 使用参数关键字传递可变数量的参数
- #341 - 定义和使用局部变量
- #354 - 自动调用正确的重载方法
- #511 - 使用参数数组的规则
- #512 - 将数据传递给采用参数数组的方法的两种方法
- #513 - 一些接受参数数组的熟悉方法
- #538 - 实现通用方法
- #539 - 调用通用方法时的类型推断
- #540 - 通用类中的非通用方法
- #541 - 通用方法类型参数能够隐藏类级别类型参数
- #549 - 匿名方法基础
- #553 - 做为静态或实例方法的匿名方法
- #554 - 将匿名方法与委托类型匹配的规则
- #584 - 定义可选参数
- #585 - 可选参数必须最后
- #586 - 可选参数的默认值必须是常量
- #587 - 若是提供,则可选参数必须正确
- #588 - 默认参数值能够为空
- #589 - 可选参数必须是输入参数
- #593 - 使用命名参数
- #594 - 当你想要使用命名参数时
- #597 - 从方法返回一个数组
- #608 - 实例方法可使用静态数据
- #632 - 部分方法
- #633 - 部分方法的实现是可选的
- #634 - 调用没有实现的部分方法
- #635 - 部分方法的局限性
- #636 - 部分方法的缘由
- #637 - 表明能够参考部分方法
- #638 - 定义和使用部分结构
- #674 - 若是参数仅由ref修饰符不一样,则能够重载
- #695 - 静态方法能够访问静态成员
- #772 - 将数组初始化为方法调用的一部分
- #774 - 将数组做为out参数传递
- #802 - 方法可能没有参数
- #807 - 定义和使用扩展方法
- #808 - 向扩展方法添加参数
- #809 - 扩展方法签名不该与类方法匹配
- #810 - 扩展方法来自何处
- #811 - 扩展方法只能访问类的公共成员
- #812 - 为值类型定义扩展方法
- #813 - 为枚举类型定义扩展方法
- #814 - 参数与参数
- #815 - 命名与位置参数
- #816 - 命名参数和可选参数组合
- #1,038 - 通用方法的类型参数约束
- #1,136 - 重载通用方法
- #1,165 - Lambda Expression Basics
- #1,166 - Lambda表达式语法
- #1,167 - 将Lambda表达式传递给方法
- #1,168 - 使用Lambda表达式做为事件处理程序
- #1,169 - Lambdas取代匿名方法
- #1,170 - 您没法使用Lambda表达式取消订阅事件
- #1,171 - Lambda Expression Internals
- #1,172 - Lambda表达式常常与Func和Action一块儿使用
- #1,173 - Lambda表达式能够只是一个表达式
- #1,174 - 将Lambda表达式分配给表达式树
- #1,175 - 表达式树的示例
- #1,176 - 表达式树如何存储在内存中
- #1,177 - Lambda表达式能够引用在表达式以外声明的变量
- #1,178 - 在调用委托时评估捕获的变量
- #1,179 - 捕获变量的终身匹配表明
- #1,180 - Lambda表达式能够修改捕获的变量
- #1,181 - 在Lambda表达式中实例化对象
- #1,182 - 在Lambda表达式中捕获for循环变量
- #1,183 - 如何在Lambda表达式中正确捕获for循环变量
- #1,186 - 在Lambda表达式中捕获foreach迭代变量
- #1,187 - 添加到调用列表时使用Lambda表达式
- #1,188 - Lambda Expression能够捕获实例数据
- #1,189 - Lambda Expression能够捕获静态数据
- #1,190 - Lambda表达式能够是递归的
- #1,191 - Lambda没法捕获ref或out参数
杂
- #453 - 使用反射获取类实现的接口列表
- #480 - 预处理指令
- #725 - 倾倒大会中的类型列表
- #726 - 列出命名空间中的全部类型
- #727 - 获取程序集中全部命名空间的列表
- #728 - 转储.NET Framework中的全部类型
- #729 - 在.NET Framework中转储全部类型,第二部分
- #731 - 获取有关班级成员的信息
- #743 - ASCII艺术生成器
- #745 - 使用ReSharper提升Visual Studio的生产力
- #748 - 使用GhostDoc工具记录您的代码
- #749 - 一些C#设计模式的例子
- #750 - 使用xUnit.net进行单元测试
- #757 - 面向对象编程的书籍
- #942 - 懒惰实例化的案例
- #943 - 懒惰实例化,解决方案#1
- #944 - 懒惰实例化,解决方案#2
- #945 - 懒惰实例化,更简单的解决方案
- #946 - 指定延迟实例化对象是否应该是线程安全的
- #947 - 使用Lambda表达式指定延迟实例化
- #984 - 生日问题
- #1,101 - 数学常数
- #1,202 - C#6.0 - 空条件运算符
- #1,203 - C#6.0 - 使用Null条件和值类型
- #1,204 - C#6.0 - 使用Null-Conditional with Indexer
- #1,205 - C#6.0 - 在调用委托时使用Null-Conditional
- #1,206 - C#6.0 - 自动属性初始化器
- #1,207 - C#6.0 - 只读属性的自动属性初始值设定项
- #1,208 - C#6.0 - 自动属性初始化器能够是任何表达式
- #1,209 - C#6.0 - 使用运营商名称
- #1,210 - C#6.0 - 主要构造函数
- #1,211 - C#6.0 - 为主构造函数添加实现
- #1,212 - C#6.0中的特征列表
- #1,214 - C#6.0 - 使用带静态类的指令
- #1,215 - C#6.0 - 字典初始化器的新语法
- #1,216 - C#6.0 - 从构造函数初始化只读自动属性
- #1,217 - C#6.0 - 为函数成员使用Lambda表达式
- #1,218 - C#6.0 - 将Lambdas用于仅限Getter的自动属性
- #1,219 - C#6.0 - 过滤异常
运营商
- #396 - 做为班级成员的运营商
- #397 - 定义运营商
- #398 - 可重载运算符
- #399 - 重载一元运算符
- #400 - 重载二元运算符
- #405 - 等价的等价方法,= =身份的运算符
- #408 - 重载参考类型的==运算符
- #409 - 重载==运算符的示例
- #410 - 为值类型重载==运算符
- #412 - 重载时的指南==值类型的运算符
- #414 - 等价能够基于字段子集
- #415 - 检查浮点数是否相等时要当心
- #416 - 使用Epsilon比较两个浮点数
- #419 - 实现IComparable时覆盖关系运算符
- #575 - 使用is运算符检查引用类型对象的类型
- #576 - 将is运算符与值类型对象一块儿使用
- #577 - 使用is运算符检查拆箱转换
- #578 - 使用as运算符进行类型转换
- #579 - 用做运算符的典型模式
- #580 - 运营商能够生成编译时错误
- #592 - 索引器中的可选参数
- #1,071 - 一元减号运算符
- #1,072 - 一元减法运算符如何失败
- #1,073 - 算术二元运算符是左关联的
- #1,074 - 在表达式中使用括号使代码更易读
- #1,075 - 运算符优先级不影响操做数评估顺序
- #1,100 - 增量和减量运算符不是线程安全的
- #1,106 - 使用逻辑异或运算符
- #1,107 - 按位AND运算符
- #1,108 - 按位OR运算符
- #1,109 - 按位非运算符
- #1,110 - 按位异或运算符
- #1,114 - 不要使用Shift运算符进行乘法运算
- #1,200 - 逻辑运算符与条件逻辑运算符
- #1,201 - 将条件逻辑运算符编写为条件
模式
安全
声明
字符串
- #14 - C#中的复合格式字符串
- #15 - 在复合格式字符串中使用格式项的长列表
- #16 - 使用一个对象数组做为复合格式字符串
- #17 - 支持复合格式化的方法
- #25 - 字符串文字
- #33 - 字符串类型
- #60 - 使用Parse从字符串转换为数字类型
- #61-非默认文化的格式化和解析字符串
- #62 - 字符串链接
- #63 - 使用StringBuilder实现更高效的字符串链接
- #64 - 字符串文字中的转义序列
- #65 - 逐字字符串文字
- #66 - 在字符串中包含引号
- #68 - 字符串平等
- #69 - 字符串是不可变的
- #70 - StringBuilder类
- #71 - StringBuilder容量
- #95 - ToString()在执行字符串链接时自动调用
- #96 - 比较字符串值
- #97 - 使用其余文化的字符串比较
- #98 - 使用索引器获取字符串中的特定字符
- #99 - 使用StringInfo从UTF32字符串中获取特定字符
- #100 - 使用IndexOf搜索字符串中的字符
- #101 - 若是字符串包含其余字符串,请使用Contains()来发现
- #102 - 使用Substring()从字符串中提取子字符串
- #103 - 插入和删除子串
- #104 - 从字符串中修剪前导和尾随字符的功能
- #105 - 将字符串函数连接在一块儿
- #106 - 使用String.Split将字符串解析为子字符串
- #392 - 使用反向方法反转字符串
- #422 - 比较字符串时ReferenceEquals的行为方式
- #478 - 逐字字符串文字能够跨越多行
- #479 - 相同的字符串文字存储在同一个对象中
- #773 - 反转包含表示为代理对的Unicode字符的字符串
- #970 - 检查字符串中的有效字符
- #1,003 - 在字符串中访问不一样编码的底层字节
- #1,004 - 将字符串转换为大写或小写
- #1,005 - 用新的子串替换子串
- #1,006 - 获取字符串的长度
- #1,007 - 获取包含代理对的字符串长度
- #1,008 - 当你忘记字符串是不可改变的时候会发生什么
- #1,009 - 字符串能够为空或空
- #1,010 - 检查字符串是空仍是空
- #1,011 - TryParse指示解析操做是否成功
- #1,116 - 使用foreach语句迭代字符串
视觉工做室
|
2,000 Things You Should Know About C# blog. Total number of posts = 1,219 Assemblies
Basics
- #1 – What the Main() Signature Looks Like
- #2 – The Smallest Possible C# Program
- #3 – Who Designed C#?
- #4 – How is C# Different from Java?
- #5 – How is C# Different from VB.NET?
- #6 – An Even Smaller C# Program
- #8 – The Main() Function Can Return an int
- #9 – Main() Should Not Be Public
- #10 – The Return Value from Main() Sets ERRORLEVEL Variable in Windows
- #12 – Read Command Line Arguments
- #18 – What Is an Identifier?
- #19 – Contextual Keywords
- #20 – Literals
- #21 – Boolean Literals
- #22 – Integer Literals
- #23 – Real Literals
- #24 – Character Literals
- #26 – Null Literal
- #27 – Expressions, Operators and Operands
- #28 – Operator Precedence
- #29 – Comments
- #35 – Declaring Variables
- #36 – Variable Initialization and Definite Assignment
- #45 – Static Members of a Class
- #46 – There Is Only One Copy of Static Data
- #52 – Arithmetic Operators
- #53 – Modulus
- #54 – Increment and Decrement Operators
- #55 – Integer Division Results in Truncation
- #56 – How to Round When Converting Float to Int
- #67 – Default Behavior for Reference Type Equality
- #72 – Hexadecimal Numbers
- #73 – Bitwise Operators
- #74 – Shift Operators
- #75 – New Bits When Shifting
- #77 – Special Floating Point Values
- #78 – Check for Special Floating Point Values
- #79 – Equality Checks for NaN
- #83 – JIT Compilation in .NET
- #84 – Viewing Metadata as Source Code
- #85 – General Structure of a C# Program
- #86 – Equality and Inequality Operators
- #87 – Relational Operators
- #88 – Conditional Operators
- #89 – The Negation Operator
- #90 – More Complex Logical Expressions
- #91 – Conditional Operators Can Short-Circuit Evaluation
- #92 – The Ternary Conditional Operator
- #110 – Combining the Arithmetic Operators with the Assignment Operator
- #111 – Combining the Logical or Shift Operators with the Assignment Operator
- #117 – Use #define to Define a Symbol
- #118 – Disabling Specific Compiler Warnings
- #181 – C# Is Strongly Typed
- #182 – C# is (Mostly) Strongly Typed
- #183 – Use var to Tell the Compiler to Figure out the Type
- #184 – Cheating Type Safety with object Type
- #185 – The Heap and the Stack
- #186 – Value Types on the Heap
- #187 – Everything Is an Object
- #188 – Objects Are on the Heap, References to Objects Are on the Stack
- #189 – Memory Management for Stack-Based Objects
- #190 – Memory Management for Heap-Based Objects
- #199 – You Can’t Explicitly Delete Heap-Based Objects
- #200 – Static Data and Constants Are Stored on the Heap
- #201 – You Can Leak Memory in C#
- #202 – All Fields in an Object Are Automatically Initialized
- #204 – Three Rules About Using Implicitly-Typed Variables
- #205 – Five Kinds of Types That Are User-Definable
- #206 – Value Types Can’t Represent Null Values
- #207 – Nullable Types
- #208 – You Can Make Any Value Type Nullable
- #209 – Why You’d Want to Store a Null Value in a Variable
- #222 – C# Is Pronounced “C Sharp”
- #223 – Enabling Code Analysis for Your Project
- #224 – One Example of a Problem that Code Analysis Would Catch
- #225 – Free Static Analysis Using FxCop
- #371 – Delegate Basics
- #372 – What Delegates Are Good For
- #373 – A Delegate Can Refer to More than One Method
- #374 – A Custom Delegate Derives from System.MulticastDelegate
- #375 – Using GetInvocationList to Get a List of Individual Delegates
- #376 – What Happens When an Exception Occurs During Delegate Invocation
- #377 – Ensure that All of a Delegate’s Methods Are Called by Using GetInvocationList
- #385 – A Delegate Instance Can Refer to Both Instance and Static Methods
- #391 – Passing a Delegate Instance as a Parameter
- #401 – Every Object Inherits an Equals Method
- #402 – Value Equality vs. Reference Equality
- #403 – Equals Method vs. == Operator for Reference Types
- #404 – Equals Method vs. == Operator for Value Types
- #406 – Overriding the Equals Method
- #407 – Why You Should Override GetHashCode when Overriding Equals
- #411 – Overriding the Equals Method for a Value Type
- #413 – Check for Reference Equality Using Object.ReferenceEquals
- #417 – Provide a Type-Specific Equals Method for Value Equality
- #418 – Implementing the IComparable Interface
- #420 – Laundry List for Implementing Value Equality and IComparable
- #421 – Value Equality and IComparable Example
- #424 – The Garbage Collector
- #425 – Nondeterministic Destruction and Object Finalization
- #426 – Use a Destructor to Free Unmanaged Resources
- #427 – Finalizer Gotchas
- #428 – A Finalizer Should Always Call the Finalizer of Its Base Class
- #429 – Use the Dispose Pattern for Deterministic Destruction
- #430 – A Dispose Pattern Example
- #431 – The using Statement Automates Invocation of the Dispose Method
- #432 – Initialize Multiple Objects in a using Statement
- #467 – Metadata
- #468 – Attributes Allow Adding Metadata to Program Elements
- #469 – Attaching an Attribute to a Type Member
- #470 – Defining Your Own Custom Attribute
- #471 – Reading the Value of an Attribute Using Reflection
- #472 – Attributes Can Be Attached to a Variety of Elements
- #473 – Specifying what Type of Elements a Custom Attribute Can Be Applied To
- #475 – Comments Occuring within String Literals Are Treated as Part of the String
- #476 – Don’t Use Unicode Escape Sequences in Identifiers
- #499 – Conditional Compilation Symbols Are Defined or Undefined
- #500 – #define and #undef Must Be at Top of File
- #501 – Differences Between #define in C++ and C#
- #502 – #define and #undef Scope
- #503 – Conditionally Compile Code Using #if / #endif Directives
- #504 – Using the #else Directive
- #505 – Using the #elif Directive
- #506 – Using Expressions in #if and #elif Directives
- #507 – You can #define Other Symbols within a #if Block
- #508 – Using the #error and #warning Directives
- #509 – Use #pragma warning Directive to Disable Compile-Time Warnings
- #514 – Examples of Operator Precedence
- #515 – Binary Operators Are Left-Associative
- #516 – The Assignment Operator is Right-Associative
- #518 – Splitting the Implementation of a Class Across Multiple Files
- #521 – Namespaces Help Organize Types
- #522 – The Fully Qualified Name for a Type Includes the Namespace
- #523 – The using Directive Allows Omitting Namespace
- #524 – All Types Within a Namespace Must Be Unique
- #525 – Namespaces Can Be Nested
- #526 – Using Statements Can Alias Nested Namespaces
- #527 – Defining a Nested Namespace Using Dot Notation
- #529 – The using Directive Can Create an Alias for a Namespace
- #530 – Namespaces vs. Assemblies
- #531 – Best Practices for Naming Namespaces
- #532 – Using Identically Named Types from Different Assemblies
- #533 – Alternate Notation for Extern Aliases
- #535 – Creating a Generic Struct
- #542 – Conventions for Naming Type Parameters
- #543 – Operations You Can Perform on a Generically Typed Object
- #544 – Specifying a Constraint for a Type Parameter
- #545 – Specifying Constraints for More than One Type Parameter
- #550 – Anonymous Method Does Not Require Formal Parameters
- #551 – Use Anonymous Method When Adding to an Invocation List
- #552 – Anonymous Methods Have Access to Local Variables Where They Are Declared
- #583 – You Can’t Modify the Iterator Variable Within a foreach Loop
- #640 – Method Names that You Cannot Use
- #659 – Get Information About an Object’s Type
- #660 – The typeof Operator Gets Information About a Type
- #661 – Every Object Has A ToString Method
- #662 – Overriding the ToString Method for a Custom Type
- #664 – Physical Memory vs. Virtual Memory
- #665 – Maximum Amount of Virtual Memory
- #666 – Looking at .NET Memory Usage Using Performance Counters
- #667 – .NET Memory Performance Counters Updated When Garbage Collector Runs
- #668 – GetTotalMemory Indicates How Much Memory You’ve Allocated
- #673 – Types Used in using Statement Must Implement IDisposable
- #689 – References and Objects
- #707 – More Than One Class in A Program Can Contain A Main Method
- #709 – A Method Can Redefine a Name Present in Parent Class
- #710 – Variables Declared in a Block Aren’t Visible Outside of the Block
- #711 – The Global Namespace
- #712 – Accessibility Summary
- #713 – Declare Accessibility Explicitly
- #714 – Accessibility of a Public Method in an Internal Type
- #718 – Scope
- #721 – Local Variable Declarations Can Hide Class Members
- #722 – Local Variable Declarations May Not Always Hide Class Members
- #724 – Fully Qualified Names for Types
- #730 – Check for null Before Iterating Using foreach Statement
- #732 – Destruction vs. Collection
- #733 – How to Tell If an Object Has Been Garbage Collected
- #734 – Accessing the Original Object Referenced through a WeakReference
- #735 – Don’t Trust WeakReference.IsAlive If It Returns true
- #736 – Target of a WeakReference Will Be null after Garbage Collection
- #738 – You Shouldn’t Explicitly Force Garbage Collection
- #740 – Short vs. Long Weak References
- #771 – Summary of System.Object Members
- #803 – Situations When You Might Use the var Keyword
- #804 – Tradeoffs when Using the var Keyword
- #805 – An Example of Discretionary Use of the var Keyword
- #806 – An Example of Mandatory Use of the var Keyword
- #846 – A Call Stack Keeps Track of Methods that Have Been Called
- #847 – How the Call Stack Works
- #921 – Objects Are Explicitly Created but Automatically Destroyed
- #922 – Ways in Which References to an Object Are Released
- #923 – An Object Isn’t Necessarily Deleted as Soon as It’s Dereferenced
- #924 – You Shouldn’t Normally Worry about Memory Management
- #940 – Finalizers Are Called when an Application Shuts Down
- #941 – Checking to See If Objects Are Disposable
- #949 – What’s in Which Version of C#
- #950 – C# Has a Unified Type System
- #951 – Not Every Type Derives from object
- #952 – Type Safety
- #953 – Static Typing vs. Dynamic Typing
- #954 – Static Typing vs. Strongly Typed
- #955 – C# Is a Managed Language
- #956 – The Common Language Infrastructure (CLI)
- #957 – Naming Files that Contain C# Code
- #958 – Naming Conventions for Identifiers
- #959 – Don’t Use Double Underscores at the Start of an Identifier
- #960 – Conventions for Naming Classes
- #961 – Retrieving Command Line and Path to Executable
- #962 – Statements Can Span Multiple Lines
- #963 – Use Braces to Enclose a Block of Statements
- #964 – Declaring a Variable within a Block of Statements
- #965 – Indent Code to Improve Readability
- #966 – Visual Studio Code Editor Helps with Indenting
- #967 – Assigning a Value to a Variable
- #968 – Reading a Value from a Variable
- #969 – Creating a Simple Console Application
- #971 – Reading a Line of Input from the Console
- #972 – Reading Keystrokes from the Console
- #973 – Format Items in Composite Format Strings Can Be in Any Order
- #974 – Well Written Code Includes Well Written Comments
- #975 – Guidelines for Commenting Your Code
- #981 – Full List of C# Keywords
- #985 – Why It’s Useful for Conditional Operators to Short-Circuit Evaluation
- #987 – The using Directive Can Create an Alias for a Type
- #988 – Using global to Explicitly Refer to a Namespace
- #989 – Formatting Numbers as Hexadecimal
- #990 – Converting Hexadecimal Strings to Numeric Data
- #994 – Unicode Basics
- #995 – Unicode Code Points
- #996 – UTF-16 Encoding, Part I
- #997 – UTF-16 Encoding, Part II
- #998 – UTF-8 Encoding
- #999 – Some Examples of UTF-16 and UTF-8 Encoding
- #1,000 – UTF-8 and ASCII
- #1,001 – Representing Unicode Surrogate Pairs
- #1,002 – Specifying Character Encoding when Writing to a File
- #1,017 – Delegate Types vs. Delegate Instances
- #1,018 – Delegate Invocation Syntax
- #1,019 – Syntax for Adding Methods to a Delegate’s Invocation List
- #1,020 – Removing Methods from a Delegate’s Invocation List
- #1,021 – What Happens to a Delegate’s Return Value
- #1,022 – How to Use Return Values from All Delegate Instances
- #1,077 – The Decimal Numeral System
- #1,078 – The Hexadecimal Numeral System
- #1,079 – The Binary Numeral System
- #1,080 – Binary Numerals Written as Hexadecimal
- #1,081 – Bits, Bytes and Nibbles
- #1,082 – Big-endian and Little-endian
- #1,083 – Using Visual Studio to Verify Little-Endianness
- #1,084 – Representing Numbers Using Scientific Notation
- #1,085 – Binary Floating Point Numbers
- #1,086 – Converting Decimal Floating Point to Binary Floating Point
- #1,087 – Representing Binary Floating Point Numbers Using Scientific Notation
- #1,088 – How 32-Bit Floating Point Numbers Are Stored in .NET, part I
- #1,089 – How 32-Bit Floating Point Numbers Are Stored in .NET, part II
- #1,090 – Using Visual Studio to Verify How Floating Point Numbers Are Stored
- #1,091 – Subnormal Floating Point Numbers
- #1,092 – Positive and Negative Zero
- #1,093 – How Positive and Negative Zero Values Are Stored
- #1,094 – Positive and Negative Infinity
- #1,095 – How Floating Point Infinity Values Are Stored
- #1,096 – Floating Point NaN Values
- #1,097 – Summary of how Floating Point Numbers Are Stored in .NET
- #1,098 – Floating Point Overflow
- #1,099 – Overloading the Increment Operator
- #1,102 – Scope vs. Declaration Space
- #1,103 – A Block Defines Both Scope and Declaration Space
- #1,104 – Can’t Re-Declare a Variable within a Nested Block
- #1,105 – Re-Declaring a Class-Level Variable within a Method
- #1,112 – How Integers Are Stored in .NET
- #1,113 – Addition of Integers Using Twos Complement
- #1,127 – Where to Find Compiler Warning Numbers
- #1,128 – Disable a Compile-Time Warning for Entire Project
- #1,149 – Generic Delegate Types
- #1,150 – Generic Delegate Type as Parameter
- #1,151 – The Func Delegate Type
- #1,152 – The Action Delegate Type
- #1,153 – Different Delegate Types Are Not Assignment Compatible
- #1,154 – Input Parameter Compatibility when Assigning to Delegate Types
- #1,155 – Return Value Compatibility when Assigning to Delegate Types
- #1,156 – Covariance and Generic Delegate Types
- #1,157 – Contravariance and Generic Delegate Types
Classes
- #141 – Implementing ICloneable for a Custom Type
- #143 – An Example of Implementing ICloneable for Deep Copies
- #144 – Using Serialization to Implement Deep Copying
- #226 – Classes and Objects
- #227 – Instances of Classes Are Created on the Heap
- #228 – Object-Oriented Programming in C# Using Classes
- #229 – The Core Principles of Object-Oriented Programming
- #230 – User-Defined Types Are First Class Citizens
- #231 – Declaring and Using Instance Fields in a Class
- #232 – Declaring and Using Instance Methods in a Class
- #233 – Returning a Result from an Instance Method
- #234 – Multiple return Statements
- #235 – return Statement Is Not Needed for void Methods
- #236 – Returning a Reference Type from a Method
- #237 – Referencing Class Fields from Within One of its Methods
- #238 – Call a Method from Another Method
- #239 – The this Reference
- #240 – Private and Public Instance Data in a Class
- #241 – Declaring and Using Private Instance Methods
- #242 – Declaring and Using a Property in a Class
- #243 – Property Get and Set Accessors
- #244 – Defining a Get Accessor for a Property
- #245 – Defining a Set Accessor for a Property
- #246 – Implementing a Read-Only Property
- #247 – Implementing a Write-Only Property
- #248 – Implementing a Property that Returns a Calculated Value
- #249 – Using a get Accessor to Clean up Property Data
- #250 – Using a set Accessor to Convert or Validate Property Data
- #251 – Class Properties Support the Principle of Encapsulation
- #252 – Automatic Properties
- #253 – Implementing a Read-Only Automatic Property
- #254 – Implementing a Read-Only Property with a Private Set Accessor
- #255 – Static Fields vs. Instance Fields
- #256 – Using Static Fields
- #257 – Private Static Fields
- #258 – Initializing a Static Variable as Part of Its Declaration
- #259 – Static vs. Instance Properties
- #260 – How Properties Look Under-the-Covers
- #261 – How Automatic Properties Look Under-the-Covers
- #262 – Passing Data to a Method Using Parameters
- #263 – A Method’s Signature Must Be Unique Within Its Type
- #285 – Class Member Overview
- #286 – A Constructor is Called When an Instance of a Class Is Created
- #287 – You Don’t Have to Define a Constructor
- #288 – Passing Arguments to a Constructor
- #289 – You Can Define Multiple Constructors
- #290 – Chaining Constructors
- #291 – No Default Constructor if You Define any Constructors
- #292 – A Static Constructor Initializes Static Data
- #293 – You Can Declare a Private Constructor
- #294 – Make All Constructors Private to Prevent Object Creation
- #295 – When Is a Static Constructor Called?
- #299 – Intellisense Shows You Available Constructors
- #303 – Accessibility of Class Members
- #304 – Private Class Members
- #305 – Public Class Members
- #306 – Protected Class Members
- #307 – Internal Class Members
- #308 – Protected Internal Class Members
- #309 – Accessing Protected Members In a Derived Class
- #310 – Accessibility of Fields in a Class
- #311 – Accessibility of Properties in a Class
- #312 – Accessibility of Methods in a Class
- #313 – Accessibility of Constructors in a Class
- #314 – Access Modifiers Are Not Allowed on Static Constructors
- #315 – Accessibility of Static Methods and Properties
- #322 – Class Accessibility
- #323 – A Generic Class is a Template for a Class
- #324 – A Generic Class Can Have More than One Type Parameter
- #325 – Intellisense Understands Generic Classes
- #326 – Generic Type vs. Constructed Type
- #329 – A Class Can Inherit Data and Behavior from Another Class
- #330 – Derived Classes Do Not Inherit Constructors
- #331 – Calling a Base Class Constructor Implicitly vs. Explicitly
- #332 – Every Class Inherits from Exactly One Class
- #333 – Class Inheritance Leads to a Hierarchy of Classes
- #334 – A Base Class Variable Can Refer to Instances of Derived Classes
- #335 – Accessing a Derived Class Using a Base Class Variable
- #336 – Declaring and Using a readonly Field
- #337 – Declaring and Using Static readonly Fields
- #338 – Static Readonly Fields vs. Constants
- #339 – Readonly Fields vs. Read-Only Properties
- #342 – Using a Static Variable to Count Instances of a Class
- #343 – Use the new Keyword to Replace a Method in a Base Class
- #344 – Hidden Base Class Member Is Invoked Based on Declared Type of Object
- #345 – Method in Derived Class Hides Base Class Method by Default
- #346 – Polymorphism
- #347 – Another Example of Polymorphism
- #348 – Virtual Methods Support Polymorphism
- #349 – The Difference Between Virtual and Non-Virtual Methods
- #350 – Method Modifiers Required for Polymorphic Behavior
- #351 – An Abstract Method Has No Implementation
- #352 – You Can’t Instantiate an Abstract Class
- #353 – Why You Might Define an Abstract Class
- #355 – Use the new Keyword to Replace a Property in a Base Class
- #356 – Hidden Base Class Property Is Used Based on Declared Type of Object
- #357 – Property in Derived Class Hides Base Class Property by Default
- #358 – Virtual Properties Support Polymorphism
- #359 – The Difference Between Virtual and Non-Virtual Properties
- #360 – Property Modifiers Required for Polymorphic Behavior
- #361 – An Abstract Property Has No Implementation
- #362 – Defining an Indexer
- #363 – An Indexer Can Have Both get and set Accessors
- #364 – Defining an Indexer whose Parameter Is an Enumerated Type
- #365 – Overloading an Indexer
- #366 – Defining an Indexer with More than One Parameter
- #517 – Static Classes
- #534 – What Good Are Generics?
- #546 – Specifying More than One Constraint for the Same Type Parameter
- #547 – Things That Can Serve as Type Parameter Constraints
- #548 – No More Than One Class for a Type Parameter Constraint
- #567 – Wider vs. Narrower Types
- #570 – Assignment Compatibility for Reference Types
- #590 – Optional Parameters in Constructors
- #601 – A Class Can Both Inherit from A Parent Class and Implement an Interface
- #602 – Initializing Fields in a Class
- #603 – Using Constants Can Force Recompilation
- #609 – Omit the Class Name for Static Members in the Same Class
- #610 – Lazy Evaluation in Property Get Accessors
- #614 – Subclass Accessibility
- #615 – You Can’t Remove a Base Class Member
- #616 – Base Class Needs to Know If Polymorphism Is Desired
- #617 – The Simplest Way to Call a Method in a Base Class
- #618 – Use the base Keyword to Call A Method in the Base Class
- #619 – Calling the Constructor in a Base Class
- #620 – Inherit from a Class In A Different Assembly
- #621 – Sealing a Class to Prevent Inheritance
- #622 – Sealing vs. Not Sealing
- #623 – Defining One Type Inside Another Type
- #624 – Accessibility of a Nested Class
- #625 – Reference a Nested Type Using Dot Notation
- #626 – Nested Type Options
- #627 – Accessibility of Nested Types in a struct or a class
- #628 – Why You Might Create a Nested Type
- #629 – Nested Types Have Full Access to Members in Parent
- #630 – Nested Type May Hide Member in Outer Class
- #631 – Code-Generation Tools and Partial Classes
- #639 – Static Class Can Contained Nested Non-Static Class
- #648 – Using an Object Initializer
- #649 – Creating an Anonymous Type
- #655 – Initializing Only Some Properties with An Object Initializer
- #656 – Nested Object Initializers
- #669 – Initializing Fields by Calling A Method
- #670 – Static vs. Instance Initialization
- #671 – A Base Class Constructor Can Call a Virtual Method
- #675 – Polymorphic Behavior Requires virtual / override Combination
- #676 – An Overridden Method Can Itself Be Overridden
- #677 – Method Marked with new Modifier Cannot Be Overridden
- #678 – A Sealed Method Cannot Be Overridden
- #679 – Hide An Inherited Method with A Virtual Method
- #680 – Virtual Modifier Combinations
- #681 – Avoid Using the new Keyword To Hide Methods
- #682 – The Real Reason for the new Keyword
- #683 – Two Ways an Object Can Behave Polymorphically
- #684 – Hidden Base Class Members Aren’t Really Hidden
- #685 – Inheritance Can Break Encapsulation
- #686 – Inheritance vs. Containment
- #687 – An Example of Containment
- #688 – Aggregation, Composition and Containment
- #690 – Using the this Keyword To Distinguish Between Fields and Parameters
- #692 – Two Approaches for Optional Parameters in Constructors
- #693 – Named Arguments in Constructors Allow the Most Flexibility
- #694 – Sequence of Events for Chained Constructors
- #696 – Using a Static Property to Count Instances
- #697 – Encapsulation is Managed through the Use of Access Modifiers
- #698 – Type Members Are Implicitly Private
- #699 – Types Are Implicitly Internal
- #700 – Using a set Accessor To Enforce Casing
- #701 – Centralize Business Rules Logic in set Accessors
- #702 – An Automatic Property Must Define Both get and set Accessors
- #703 – Object Initializers Allow Setting Either Fields or Properties
- #704 – Using an Object Initializer with Any Constructor
- #708 – A Name Must Be Unique Within A Declaration Space
- #715 – Private Members Are Not Visible in a Derived Class
- #716 – How Derived Classes Can Access Protected Members
- #717 – Class Members Can’t Be More Accessible Than Their Type
- #719 – Location of Declarations within A Class Doesn’t Matter
- #720 – Location of Declarations within A Method Does Matter
- #723 – New Methods in Subclass May Not Be Visible in Derived Classes
- #737 – When to Implement a Finalizer
- #739 – Avoid Accessing an Object After Its Been Finalized
- #741 – The Basics of Inheritance
- #742 – A Simple Example of Inheritance
- #744 – The Purpose of Inheritance
- #751 – Inheritance Only Partially Preserves Encapsulation
- #752 – C# Does Not Support Multiple Inheritance
- #753 – Implicitly Upcast to a Base Class Reference
- #754 – Downcast to a Reference to a Derived Class
- #768 – When to Call the Constructor of a Base Class
- #769 – Pattern – Call a Base Class Method When You Override It
- #783 – When to Create a Static Class
- #784 – When Not to Use a Static Class
- #787 – Avoid Public Fields in a Class
- #788 – A Backing Field Stores Data for a Property
- #790 – Property get and set Accessors Can Have Different Access Modifiers
- #791 – Properties Are Not Variables
- #795 – Rules for Creating an Immutable Class
- #796 – Default Accessibility for Property Accessors
- #797 – Setting Accessibility for Property Accessors
- #798 – You Can’t Override Accessors that Are Not Accessible
- #800 – A Property in an Interface May Include One or Two Accessors
- #801 – An Example of a Simple Immutable Class
- #817 – What Happens When a Static Constructor Throws an Exception
- #818 – What Happens When an Instance Constructor Throws an Exception
- #819 – A Private Constructor May Prevent Inheritance
- #820 – A Protected Constructor Allows a Subclass to Create Instances
- #824 – A Copy Constructor Makes a Copy of an Existing Object
- #825 – Shallow Copies
- #826 – Deep Copies
- #827 – Making a Deep Copy with a Copy Constructor
- #828 – Implementing Both a Copy Constructor and ICloneable
- #829 – Add Comments to Indicate Shallow vs. Deep Copying
- #830 – The Problem with ICloneable
- #831 – Implementing a Copy Constructor in a Derived Class
- #832 – The Sequence in Which Finalizers Are Called
- #1, 023 – Fields Are Initialized Before Execution of Constructors
- #1,024 – Exposing internal Members to Another Assembly
- #1,027 – Type Parameters vs. Type Arguments in a Generic Class
- #1,028 – Generic Types vs. Generic Methods
- #1,029 – How to Define a Constructor in a Generic Type
- #1,030 – Requiring Generic Type Parameters to Derive from a Specified Class
- #1,031 – Requiring Generic Type Parameters to Implement an Interface
- #1,032 – Requiring Generic Type Parameters to Be a Reference or Value Type
- #1,033 – Requiring a Generic Type Parameter to Have a Parameterless Constructor
- #1,034 – Making One Type Parameter Depend on Another
- #1,035 – Summary of Type Parameter Constraints
- #1,036 – Specifying Multiple Type Parameter Constraints
- #1,037 – Specifying Type Parameter Constraints for More than One Type Parameter
- #1,039 – Deriving from a Generic Class
- #1,040 – Deriving from a Constructed Type
- #1,041 – Adding New Type Parameters when You Derive from a Generic Class
- #1,042 – Deriving from a Self-Referencing Constructed Type, Part I
- #1,043 – Deriving from a Self-Referencing Constructed Type, part II
- #1,044 – How Static Data Behaves in Generic Types
- #1,070 – A Generic Type Can Be Compiled
- #1,134 – Use “of” Terminology for Generics
- #1,135 – Overloading a Generic Class
- #1,137 – Generic Methods in Non-Generic Classes
- #1,138 – Type Parameters in Generic Methods Can Be Constrained
- #1,139 – The Problem with Comparisons of Objects in Generic Types
- #1,140 – Comparing Reference-Typed Objects in Generic Types
- #1,141 – Reference Equality Used Even when Overload Available for Typed Parameter
- #1,142 – Using EqualityComparer to Compare Objects in Generic Types
- #1,143 – Implement IEquatable in a Generic Type
- #1,144 – Getting Type Information about a Generic Type
- #1,145 – Using Reflection on Generic Type Parameters
- #1,146 – Generics Don’t Support Covariance
- #1,147 – Why Generics Don’t Support Covariance
- #1,148 – When to Use a Generic Covariant Interface
Collections
Data Types
- #30 – Types, Variables, Values, Instances
- #31 – Value Types and Reference Types
- #32 – Built-In Types
- #34 – The object Type
- #37 – All Value Types Have a Default Constructor
- #38 – Data Type Hierarchy
- #39 – MinValue / MaxValue for Numeric Types
- #40 – TrueString and FalseString
- #41 – Instantiating Reference Types
- #42 – Interacting With an Object
- #43 – Objects Are Instantiated on the Heap
- #44 – Multiple References to the Same Object
- #47 – Numeric Conversions Through Casting
- #48 – How Explicit Casts Fail
- #49 – When to Use the Decimal Type
- #50 – Static Methods of System.Char
- #51 – Float Literals Must Use f Suffix
- #57 – Overflow on Integer Operations
- #58 – Generate Exceptions on Integer Overflow Using Checked Operator
- #59 – Using Unchecked Keyword to Avoid Overflow Exceptions
- #76 – Arithmetic Operations with Small Integers
- #80 – Use Decimal Type for Monetary Calculations
- #81 – DateTime and TimeSpan Types
- #82 – Some Common DateTime and TimeSpan Functions
- #93 – Escape Sequences in Character Literals
- #94 – Converting Between Char and Numeric Types
- #107 – Defining and Using a Struct
- #108 – Defining a Constructor for a Struct
- #109 – Defining and Using Enums
- #119 – Arrays
- #120 – Array Declaration and Instantiation
- #121 – Array Initialization
- #122 – Arrays Can Contain Any Type of Object
- #123 – Storing Arbitrary Objects in an Array
- #124 – Declaring and Instantiating Multidimensional Arrays
- #125 – Initializing Multidimensional Arrays
- #126 – Initializing Arrays of Reference-Type Objects
- #127 – Declaring and Instantiating Jagged Arrays
- #128 – Accessing Elements in Jagged Arrays
- #129 – Initializing Jagged Arrays
- #130 – Default Values of Array Elements
- #131 – Arrays Derive from System.Array
- #132 – Arrays That Are Both Multidimensional and Jagged
- #133 – An Array’s Length is Fixed
- #134 – Sorting One-Dimensional Arrays
- #135 – Implement IComparable to Allow Sorting a Custom Type
- #136 – Sorting an Array of Values Based on an Array of Keys
- #137 – Sorting an Array Using an Independent Comparer Method
- #138 – Searching a Sorted Array
- #139 – Using the Array.Clone Method to Make a Shallow Copy of an Array
- #140 – Making a Deep Copy of an Array Using an Object’s Clone Method
- #142 – Implement ICloneable All the Way Down for Deep Copies
- #145 – Using Array.Find to Search an Unsorted Array
- #146 – Using Array.FindAll to Find a Set of Matching Elements in an Array
- #147 – Getting the Average of an Array of Numbers
- #148 – Getting the Average of an Array of Custom Objects
- #149 – Using IEnumerable.Aggregate to Perform a Calculation Based on All Elements in an Array
- #150 – Other Aggregate Functions You Can Apply to Numeric Arrays
- #151 – Determining Whether an Array Contains a Specific Element
- #152 – Remove Duplicate Array Entries Using Distinct() Method
- #153 – Returning a Subset of Array Elements Matching a Particular Criteria
- #154 – Using an Invalid Array Index Causes an Exception to Be Thrown
- #155 – Iterating Through An Array Using the foreach Statement
- #156 – Using break and continue in foreach Loops
- #191 – Changing the Underlying Type of an enum
- #192 – Using Non-Default Constant Values for Enumeration Members
- #193 – An Enum Type’s ToString Method Displays the Member’s Name
- #194 – Storing a Set of Boolean Values as Bits
- #195 – Using an Enum Type to Store a Set of Flags
- #196 – Using the ToString() Method on a Flags-Based Enum Type
- #197 – Checking an Enumerated Value for the Presence of a Flag
- #198 – Enumeration Values That Set Combinations of Flags
- #203 – It’s Good Practice to Always Have a 0-Valued Enumeration Constant
- #210 – Checking to See Whether a Nullable Object Has a Value
- #211 – Using the Null-Coalescing (??) Operator
- #212 – Using Several Null-Coalescing (??) Operators in the Same Expression
- #213 – Final Operand When Using Null-Coalescing (??) Operator
- #214 – Using the Null-Coalescing (??) Operator with Reference Types
- #215 – Using the Null-Coalescing (??) Operator with Custom Nullable Types
- #216 – Null-Coalescing (??) Operator Is Equivalent to GetValueOrDefault Method
- #217 – T? Is Equivalent to Nullable<T>
- #218 – Store Value-Typed Objects on the Heap Through Boxing
- #219 – Unboxing a Boxed Object
- #220 – Boxing Can Happen Automatically
- #221 – When Unboxing, You Must Match the Original Type Exactly
- #280 – Implicitly-Typed Arrays
- #296 – You Must Assign a Value to All Fields Before Using a struct
- #297 – Three Different Ways to Initialize the Contents of a struct
- #298 – A struct Can Have Several Constructors
- #316 – Declaring and Using Constants
- #317 – Constants Can Be Class Members
- #318 – You Can’t Use the static Modifier On a Constant
- #319 – You Initialize a Constant Using an Expression
- #320 – The Constant Expression for a Reference-Typed Constant Must Be Null
- #321 – Accessibility of Constants
- #327 – Assigning a struct to a New Variable Makes a Copy
- #328 – Copying a struct Will Not Copy Underlying Reference Types
- #367 – Iterating through All Possible Values of an Enumeration Type
- #433 – All structs Inherit from System.ValueType
- #457 – Converting Between enums and their Underlying Type
- #458 – Errors While Converting Between enum and Underlying Type
- #459 – Assigning a Value of a Different Type to an enum
- #460 – Converting from a String to an Enum Type
- #461 – Enumeration Elements Don’t Need to Be Sequential
- #462 – Duplicate Enumerators in an Enumerated Type
- #463 – Enumerated Values Can Be Any Constant Expression
- #464 – Getting an Enumeration’s Underlying Type at Runtime
- #465 – Dumping All Names and Values for an Enumerated Type
- #466 – Explicitly Assigning Only Some Enumerated Values
- #477 – Full List of Escape Sequences for Character Literals
- #510 – Declaring More than One Local Variable On the Same Line
- #519 – Differences Between structs and classes
- #520 – Choosing Between a struct and a Class
- #566 – Implicit Conversions to Nullable Types
- #568 – Array Covariance
- #569 – Assignment Compatibility
- #571 – Covariance in Programming Languages
- #572 – Why Array Covariance Is Called Covariance
- #573 – Array Covariance Doesn’t Apply to Value Types
- #574 – The Problem with Array Covariance
- #581 – Boxing and Unboxing Nullable Types
- #582 – Use the as Operator to Unbox to a Nullable Type
- #596 – Implicitly-Typed Arrays and Best Type Inference
- #598 – Clearing an Array or a Subset of an Array
- #599 – Copying an Array Onto Another Array
- #600 – Reversing the Elements in an Array
- #611 – Accessibility of Members in a struct
- #641 – Using the this Keyword in a struct
- #642 – Reassigning the this Pointer in a struct
- #643 – The Constructor for a struct Must Initialize All Data Members
- #644 – Chaining struct Constructors
- #645 – You Can Chain to the Default Constructor for a struct
- #646 – Value Types Don’t Have Finalizers
- #650 – Creating an Array of Anonymously-Typed Objects
- #651 – Passing an Anonymously-Typed Object to a Method
- #652 – Using Expressions and Variables in Anonymous Type Declarations
- #653 – Projection Initializers
- #654 – You Can’t Use an Anonymous Type Directly
- #657 – Boxing Makes a Copy of An Object
- #658 – What Boxing and Unboxing Look Like in IL
- #767 – A struct Is Implicitly Sealed
- #775 – Copying an Array of Anonymously-Typed Objects
- #776 – Declaring and Using Nullable structs
- #777 – A struct Isn’t Mutable When Used as a Property
- #778 – A struct Isn’t Mutable When Used in a Collection
- #779 – Methods in struct that Modify Elements Can Be Dangerous
- #780 – The Case for Immutable structs
- #781 – A struct Can Implement an Interface
- #782 – You Can Create an Instance of a struct Without the new Keyword
- #789 – Grouping Constants into Their Own Class
- #833 – Some Examples of Anonymous Object Initializers
- #834 – Use a Generic List to Store a Collection of Objects
- #835 – A Generic List Can Store Value-Typed or Reference-Typed Objects
- #836 – Initializing a Generic List with an Object Initializer
- #837 – Object Initializers within Collection Initializers
- #838 – Object and Collection Initializers as Parameters
- #839 – Anonymous Type Limitations
- #840 – Use an Anonymous Type as a Read-Only Subset of an Object
- #982 – An Enum Type Can Store a Maximum of 32 Flags
- #983 – Using a BitArray to Store a Large Collection of Boolean Values
- #991 – Using the Round-Trip Format Specifier
- #992 – The System.Char Data Type
- #993 – Some Examples of Characters
- #1,012 – Options for Array Declaration, Instantiation and Initialization
- #1,013 – default Operator Returns Default Values
- #1,014 – Using default Operator in a Generic Class
- #1,015 – Rendering a Byte Array as a Series of Hex Characters
- #1,016 – Retrieving the Length of an Array
- #1,025 – Converting between enum Types
- #1,026 – Checking a Flagged enum Type for Validity
- #1,045 – Implicit Conversions When Assigning from a Nullable Type
- #1,046 – Implicit vs. Explicit Conversions
- #1,047 – The Implicit Identity Conversion
- #1,048 – No Implicit Conversions between Signed vs. Unsigned
- #1,049 – Full List of Implicit Numeric Conversions
- #1,050 – Implicit Conversions between Nullable Types
- #1,051 – Implicit Reference Conversions
- #1,052 – Boxing Is a Kind of Implicit Conversion
- #1,053 – Implicit Conversion from Type dynamic
- #1,054 – Implicit Conversions from Constant Expressions
- #1,055 – Defining Your Own Implicit Conversions
- #1,056 – Custom Implicit Conversions between Reference Types
- #1,057 – Custom Explicit Conversions
- #1,058 – Custom Implicit Conversions in Both Directions
- #1,059 – Converting from Numeric to Enumerated Types
- #1,060 – Explicit Conversions between Nullable Types
- #1,061 – Explicit Reference Conversions
- #1,062 – Unboxing Conversions
- #1,063 – Explicit Conversions and Type Parameters
- #1,064 – Getting Around Inability to Explicitly Convert Type Parameters
- #1,065 – Cases When Array Covariance Doesn’t Work
- #1,066 – Constraining a Type Parameter on a Generic Interface
- #1,076 – Implicit Numeric Conversions from the char Type
- #1,111 – Converting an Integer to a String in a Different Base
- #1,198 – Using Operators with Nullable Types
- #1,199 – Equality and Inequality with Nullable Types
Debugging
Enumeration
Events
Exceptions
Input/Output
Interfaces
Memory
Methods
- #264 – By Default, Parameters Are Passed by Value
- #265 – Passing Reference Types by Value
- #266 – You Can’t Prevent a Method from Changing the Contents of Reference Types
- #267 – Passing Data Back from a Method Using out Parameters
- #268 – You Must Set the Value of All out Parameters Before Returning from a Method
- #269 – Use ref Modifier on Parameters that Are Input/Output
- #270 – Passing a Reference Type by Reference
- #271 – Passing a Reference Type as an Output Parameter
- #272 – Differences Between ref and out Parameters
- #273 – Parameter Modifier Summary
- #274 – Can’t Overload if Methods Differ Only by ref and out Modifiers
- #275 – Passing a struct to a Method
- #276 – Passing a struct by Reference
- #277 – Passing an Array to a Method
- #278 – Passing an Array by Reference
- #279 – Passing a Multidimensional Array to a Method
- #281 – Declaring and Using Static Methods in a Class
- #282 – Creating Private Static Methods
- #283 – Instance Methods Can Call Static Methods
- #284 – Static Methods Can Call Instance Methods
- #340 – Use the params Keyword to Pass a Variable Number of Arguments
- #341 – Defining and Using Local Variables
- #354 – Correct Overloaded Method Is Automatically Called
- #511 – Rules for Using Parameter Arrays
- #512 – Two Ways to Pass Data to a Method that Takes a Parameter Array
- #513 – Some Familiar Methods that Accept Parameter Arrays
- #538 – Implement a Generic Method
- #539 – Type Inference When Calling Generic Methods
- #540 – Non-Generic Methods in a Generic Class
- #541 – Generic Method Type Parameters Can Hide Class-Level Type Parameters
- #549 – Anonymous Method Basics
- #553 – Anonymous Methods as Static or Instance Methods
- #554 – Rules for Matching an Anonymous Method to a Delegate Type
- #584 – Defining an Optional Parameter
- #585 – Optional Parameters Must Come Last
- #586 – Default Values for Optional Parameters Must Be Constants
- #587 – If Provided, Optional Arguments Must Be in Correct Order
- #588 – A Default Parameter Value Can Be Null
- #589 – Optional Parameters Must Be Input Parameters
- #593 – Using Named Arguments
- #594 – When You’d Want to Use Named Arguments
- #597 – Returning an Array from a Method
- #608 – Instance Methods Can Use Static Data
- #632 – Partial Methods
- #633 – The Implementation of A Partial Method Is Optional
- #634 – Invoking Partial Methods That Have No Implementation
- #635 – Limitations on Partial Methods
- #636 – The Reason for Partial Methods
- #637 – A Delegate Can Refer to A Partial Method
- #638 – Defining and Using a Partial struct
- #674 – Can Overload If Parameters Differ Only by ref Modifier
- #695 – Static Methods Can Access Static Members
- #772 – Initializing an Array as Part of a Method Call
- #774 – Passing an Array as an out Parameter
- #802 – A Method Might Have No Parameters
- #807 – Defining and Using an Extension Method
- #808 – Adding Parameters to an Extension Method
- #809 – Extension Method Signatures Shouldn’t Match Class Methods
- #810 – Where Extension Methods Came From
- #811 – Extension Methods Can Only Access Public Members of Class
- #812 – Defining an Extension Method for a Value Type
- #813 – Defining an Extension Method for an Enumerated Type
- #814 – Parameters vs. Arguments
- #815 – Named vs. Positional Arguments
- #816 – Named Argument and Optional Parameter Combinations
- #1,038 – Type Parameter Constraints on Generic Methods
- #1,136 – Overloading a Generic Method
- #1,165 – Lambda Expression Basics
- #1,166 – Lambda Expression Syntax
- #1,167 – Passing a Lambda Expression to a Method
- #1,168 – Using a Lambda Expression as an Event Handler
- #1,169 – Lambdas Supersede Anonymous Methods
- #1,170 – You Can’t Unsubscribe from an Event Using a Lambda Expression
- #1,171 – Lambda Expression Internals
- #1,172 – Lambda Expressions Often Used with Func and Action
- #1,173 – Lambda Expression Can Be Just an Expression
- #1,174 – Assigning a Lambda Expression to an Expression Tree
- #1,175 – An Example of an Expression Tree
- #1,176 – How an Expression Tree is Stored in Memory
- #1,177 – Lambda Expressions Can Reference Variables Declared Outside of Expression
- #1,178 – Captured Variables Are Evaluted when a Delegate Is Invoked
- #1,179 – Captured Variable’s Lifetime Matches Delegate
- #1,180 – Lambda Expressions Can Modify Captured Variables
- #1,181 – Instantiating an Object within a Lambda Expression
- #1,182 – Capturing a for Loop Variable in a Lambda Expression
- #1,183 – How to Correctly Capture a for Loop Variable in a Lambda Expression
- #1,186 – Capturing a foreach Iteration Variable in a Lambda Expression
- #1,187 – Using a Lambda Expression When Adding to an Invocation List
- #1,188 – Lambda Expression Can Capture Instance Data
- #1,189 – Lambda Expression Can Capture Static Data
- #1,190 – A Lambda Expression Can Be Recursive
- #1,191 – Lambda Can’t Capture ref or out Parameters
Miscellaneous
- #453 – Use Reflection to Get a List of Interfaces that a Class Implements
- #480 – Pre-Processing Directives
- #725 – Dumping Out a List of Types in an Assembly
- #726 – Listing all Types within a Namespace
- #727 – Get a List of All Namespaces in an Assembly
- #728 – Dumping Out All Types in the .NET Framework
- #729 – Dumping Out All Types in .NET Framework, part II
- #731 – Getting Information About the Members of a Class
- #743 – ASCII Art Generator
- #745 – Use ReSharper to Increase Your Productivity in Visual Studio
- #748 – Use GhostDoc Tool to Document Your Code
- #749 – Example of Some C# Design Patterns
- #750 – Use xUnit.net for Unit Testing
- #757 – Books on Object-Oriented Programming
- #942 – The Case for Lazy Instantiation
- #943 – Lazy Instantiation, Solution #1
- #944 – Lazy Instantiation, Solution #2
- #945 – Lazy Instantiation, an Easier Solution
- #946 – Specifying Whether Lazy Instantiated Object Should Be Thread-Safe
- #947 – Specifying Lazy Instantiation Using a Lambda Expression
- #984 – The Birthday Problem
- #1,101 – Mathematical Constants
- #1,202 – C# 6.0 – Null-Conditional Operator
- #1,203 – C# 6.0 – Using the Null-Conditional with Value Types
- #1,204 – C# 6.0 – Using Null-Conditional with Indexer
- #1,205 – C# 6.0 – Using the Null-Conditional when Invoking a Delegate
- #1,206 – C# 6.0 – Auto-Property Initializers
- #1,207 – C# 6.0 – Auto-Property Initializers for Read-Only Properties
- #1,208 – C# 6.0 – Auto-Property Initializers Can Be Any Expression
- #1,209 – C# 6.0 – Using the nameof Operator
- #1,210 – C# 6.0 – Primary Constructors
- #1,211 – C# 6.0 – Adding Implementation for a Primary Constructor
- #1,212 – List of Features Shipping in C# 6.0
- #1,214 – C# 6.0 – using Directive with Static Class
- #1,215 – C# 6.0 – New Syntax for Dictionary Initializers
- #1,216 – C# 6.0 – Initializing Read-Only Auto-Properties from Constructors
- #1,217 – C# 6.0 – Using Lambda Expressions for Function Members
- #1,218 – C# 6.0 – Using Lambdas for Getter-Only Auto-Properties
- #1,219 – C# 6.0 – Filtering Exceptions
Operators
- #396 – Operators as Class Members
- #397 – Defining an Operator
- #398 – Overloadable Operators
- #399 – Overloading Unary Operators
- #400 – Overloading Binary Operators
- #405 – Equals Method for Equivalence, == Operator for Identity
- #408 – Overloading the == Operator for a Reference Type
- #409 – Example of Overloading the == Operator
- #410 – Overloading the == Operator for a Value Type
- #412 – Guidelines when Overloading == Operator for a Value Type
- #414 – Equivalence Can Be Based on a Subset of Fields
- #415 – Be Careful When Checking Floating Point Numbers for Equality
- #416 – Use an Epsilon to Compare Two Floating Point Numbers
- #419 – Override Relational Operators When You Implement IComparable
- #575 – Using the is Operator to Check the Type of a Reference-Typed Object
- #576 – Using the is Operator with Value Typed Objects
- #577 – Using the is Operator to Check for an Unboxing Conversion
- #578 – Using the as Operator to Do Type Conversions
- #579 – Typical Pattern for Using as Operator
- #580 – as Operator Can Generate Compile-Time Errors
- #592 – Optional Parameters in Indexers
- #1,071 – The Unary Minus Operator
- #1,072 – How the Unary Minus Operator Can Fail
- #1,073 – Arithmetic Binary Operators are Left-Associative
- #1,074 – Use Parentheses in Expressions to Make Code More Readable
- #1,075 – Operator Precedence Doesn’t Affect Operand Evaluation Order
- #1,100 – Increment and Decrement Operators Are Not Thread-Safe
- #1,106 – Using the Logical Exclusive OR Operator
- #1,107 – The Bitwise AND Operator
- #1,108 – The Bitwise OR Operator
- #1,109 – The Bitwise NOT Operator
- #1,110 – The Bitwise Exclusive OR Operator
- #1,114 – Don’t Use Shift Operators to Do Multiplication
- #1,200 – Logical Operators vs. Conditional Logical Operators
- #1,201 – Writing Conditional Logical Operators as Conditionals
Patterns
Security
Statements
- #157 – Iterating Using the while Loop
- #158 – A while Loop Expression Is Evaluated Before Executing the Loop
- #159 – A while Loop Might Execute Forever
- #160 – A while Loop Can Exit on break, goto, return or throw Statements
- #161 – Use continue to Jump to Next Iteration of while Loop
- #162 – do/while Loop Executes at Least Once
- #163 – Iterating Using the for Loop
- #164 – for Loop Clauses Can Contain Lists of Statements
- #165 – Any Clause of the for Loop May Be Left Empty
- #166 – Using the for Statement to Create an Infinite Loop
- #167 – Use continue to Jump to Next Iteration of for Loop
- #168 – Use if Statement to Conditionally Execute a Block of Code
- #169 – The if Statement Must Always Include a Boolean Expression
- #170 – The else Portion of an if Statement
- #171 – if/else Statement Can Have One or More Statements in Body
- #172 – Nested if Statements
- #173 – The switch Statement
- #174 – Multiple Case Statements in switch Statement Can Share Code
- #175 – The default Clause of a switch Statement
- #176 – Switch Statement Doesn’t Fall Through from Case to Case
- #177 – Using goto in a switch Statement
- #178 – Throwing an Exception from a switch Statement
- #986 – Using goto to Jump to a Label
- #1,115 – Iterating Through a Collection Using the foreach Statement
- #1,119 – Scope of Iteration Variable Is Limited to Body of foreach
- #1,120 – The Iteration Variable in a foreach Loop Is Read-Only
- #1,121 – Modifying Elements in a Collection Using foreach
- #1,122 – It’s Okay to Capture Variables within a foreach Loop
- #1,123 – Using foreach to Iterate on a Multidimensional Array
- #1,124 – Iterate through Jagged Array with Nested foreach
- #1,125 – Use of break and continue Statements
- #1,126 – Rewriting a Loop to Avoid continue Statement
Strings
- #14 – Composite Format Strings in C#
- #15 – Using Long Lists of Format Items in Composite Format Strings
- #16 – Use an Array of Objects for a Composite Format String
- #17 – Methods that Support Composite Formatting
- #25 – String Literals
- #33 – The string Type
- #60 – Using Parse to Convert from String to Numeric Types
- #61- Formatting and Parsing Strings for Non-Default Cultures
- #62 – String Concatenation
- #63 – Use StringBuilder for More Efficient String Concatenation
- #64 – Escape Sequences in String Literals
- #65 – Verbatim String Literals
- #66 – Including Quotation Marks in Strings
- #68 – String Equality
- #69 – Strings are Immutable
- #70 – The StringBuilder Class
- #71 – StringBuilder Capacity
- #95 – ToString() Called Automatically When Doing String Concatenation
- #96 – Comparing String Values
- #97 – String Comparisons Using Other Cultures
- #98 – Using An Indexer to Get A Specific Character in A String
- #99 – Use StringInfo to Get Specific Characters From A UTF32 String
- #100 – Using IndexOf to Search for Characters Within A String
- #101 – Use Contains() to Discover If A String Contains Other Strings
- #102 – Use Substring() to Extract Substrings From A String
- #103 – Inserting and Removing Substrings
- #104 – Functions to Trim Leading and Trailing Characters From A String
- #105 – Chaining String Functions Together
- #106 – Using String.Split to Parse A String Into Substrings
- #392 – Reversing a String Using the Reverse Method
- #422 – How ReferenceEquals Behaves When Comparing Strings
- #478 – Verbatim String Literals Can Span Multiple Lines
- #479 – Identical String Literals Are Stored in the Same Object
- #773 – Reversing a String that Contains Unicode Characters Expressed as Surrogate Pairs
- #970 – Checking for Valid Characters in a String
- #1,003 – Accessing Underlying Bytes in a String for Different Encodings
- #1,004 – Converting a String to Uppercase or Lowercase
- #1,005 – Replacing a Substring with a New Substring
- #1,006 – Getting the Length of a String
- #1,007 – Getting Length of String that Contains Surrogate Pairs
- #1,008 – What Happens When You Forget That Strings Are Immutable
- #1,009 – A String Can Be Null or Empty
- #1,010 – Checking to See Whether a String is Null or Empty
- #1,011 – TryParse Indicates Whether a Parse Operation Will Succeed
- #1,116 – Iterating Through a String Using the foreach Statement
Visual Studio
|