惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
月光博客
月光博客
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
U
Unit 42
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
宝玉的分享
宝玉的分享
B
Blog
C
Check Point Blog
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
量子位
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell

博客园 - 逗号李

任务安排 outofmemory issue for stringbuilder connection string for PostgreSql 如何建立测试生态系统 Eclipse 运行测试每次都先重新build 提高软件测试能力的19条建议 敏捷-1 15个JavaScript Web UI库 关于 分布式Oracle中 database link csharp notes - 3 csharp notes – 2 CHM文件无法显示问题 - 逗号李 - 博客园 MVC2 leanring –1 Cocoa hibernate基础[转] hibernate基础[转] Oracle 中统计时间间隔的方法 windows live writer 配置出错? 如何在用户控件中操作页面中的控件?
csharp notes - 1
逗号李 · 2010-03-31 · via 博客园 - 逗号李

1. The particular overload to call is determined statically (at compile time) rather than dynamically (at runtime).

2. Dynamic type checking is possible because each object on the heap internally stores a little type token. This token can be retrieved by calling the GetType method of object.

3. GetType is evaluated dynamically at runtime; typeof is evaluated statically at compile time.

4. A struct can have all the members a class can, except the following:

  • A parameterless constructor

  • A finalizer

  • Virtual members

A parameterless constructor that you can't override implicitly exists. This performs a bitwise-zeroing of its fields.

When you define a struct constructor, you must explicitly assign every field

5. internal: Accessible only within containing assembly or friend assemblies. The default accessibility for nonnested types

private: The default accessibility members of a class or struct

public: The implicit accessibility for members of an enum or interface

6. A type caps the accessibility of its declared members

class C { public void Foo( ) {} }

C's (default) internal accessibility caps Foo's accessibility, effectively making Foo internal

7. interface

1) A class can implement multiple interfaces

2) Interface members are all implicitly abstract

3) Structs can implement interfaces

An interface can contain only methods, properties, events, and indexers, which noncoincidentally are precisely the members of a class that can be abstract.

Even though Countdown is an internal class, its members that implement IEnumerator can be called publicly by casting an instance of Countdown to IEnumerator.

As a general rule:

  • Use classes and subclasses for types that naturally share an implementation.

  • Use interfaces for types that have independent implementations.