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

推荐订阅源

IT之家
IT之家
J
Java Code Geeks
小众软件
小众软件
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
量子位
M
MIT News - Artificial intelligence
Last Week in AI
Last Week in AI
L
LangChain 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.