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

推荐订阅源

U
Unit 42
罗磊的独立博客
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
V
V2EX
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
量子位
MyScale Blog
MyScale Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
有赞技术团队
有赞技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
B
Blog

博客园 - 逗号李

任务安排 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.