概念记录 - 学习时遇到的概念和知识的简单记录
2009-10-13 12:38
232 查看
.NET Related:
***************************
Interface
Abstract Class
Component
Serialization
Binary
SOAP - A bit slower than Binary method
XML - Can't serialize non-public members. Can be used on cross-platform situation
Deserialization
Reflection
ConstructorInfo
?How to load a type at runtime into assembly?
Answer:
Event
Declared in a class, which has
public delegate void <custom>EventHandler(object Sender, EventArgs e) to indicate signature of event handler;
a field-like event (i.e Changed);
Invoking the event(i.e a protected virtual On<custom>Changed(EventArgs e)) Changed(sender, e) at certain place;
Delegate
From MSDN:
Delegates are useful when:
A single method is being called.
A class may want to have multiple implementations of the method specification.
It is desirable to allow using a static method to implement the specification.
An event-like design pattern is desired.
The caller has no need to know or obtain the object that the method is defined on.
The provider of the implementation wants to "hand out" the implementation of the specification to only a few select components.
Easy composition is desired.
Interfaces are useful when:
The specification defines a set of related methods that will be called.
A class typically implements the specification only once.
The caller of the interface wants to cast to or from the interface type to obtain other interfaces or classes
Abstract class and memebers
You are not required to declare a method as virtual. But, if you don't, and you derive from the class, and your derived class has a method by the same name and signature, you'll get a warning that you are hiding a parent's method. You will have to use the 'new' keyword to remove the warning.
This functionality is there to help deal with compatibility issues between versions of classes.
Virtual class and members
Virtual basically tells the compiler that the V-Table entry can be overwritten by children.
Difference between Interface and Abstract Class
An Interface cannot implement methods.
An abstract class can implement methods.
An Interface can only inherit from another Interface.
An abstract class can inherit from a class and one or more interfaces.
An Interface cannot contain fields.
An abstract class can contain fields.
An Interface can contain property definitions.
An abstract class can implement a property.
An Interface cannot contain constructors or destructors.
An abstract class can contain constructors or destructors.
An Interface can be inherited from by structures.
An abstract class cannot be inherited from by structures.
An Interface can support multiple inheritance.
An abstract class cannot support multiple inheritance.
simple type aliases a struct type
What's the 'new' 'override' keyword?
Using new
Methods from derived class and base class are separated. Method in derived class behaves like a completely new one. It doesn't implement base class methods(containing same name abstract methods will cause compling error).
Using override
When calling method through a base class pointer to derived class object, override method will find the method in derived class instead of calling method in base class
Thread Safety
Session
AppDomain
Try Catch meaning
Catch will 'catch' Exception, stop excuting current calling and return to former calling point. Otherwise a Unhandled Exception will show up stopping application(hang).
***************************
Interface
Abstract Class
Component
Serialization
Binary
SOAP - A bit slower than Binary method
XML - Can't serialize non-public members. Can be used on cross-platform situation
Deserialization
Reflection
ConstructorInfo
?How to load a type at runtime into assembly?
Answer:
Event
Declared in a class, which has
public delegate void <custom>EventHandler(object Sender, EventArgs e) to indicate signature of event handler;
a field-like event (i.e Changed);
Invoking the event(i.e a protected virtual On<custom>Changed(EventArgs e)) Changed(sender, e) at certain place;
Delegate
From MSDN:
Delegates are useful when:
A single method is being called.
A class may want to have multiple implementations of the method specification.
It is desirable to allow using a static method to implement the specification.
An event-like design pattern is desired.
The caller has no need to know or obtain the object that the method is defined on.
The provider of the implementation wants to "hand out" the implementation of the specification to only a few select components.
Easy composition is desired.
Interfaces are useful when:
The specification defines a set of related methods that will be called.
A class typically implements the specification only once.
The caller of the interface wants to cast to or from the interface type to obtain other interfaces or classes
Abstract class and memebers
You are not required to declare a method as virtual. But, if you don't, and you derive from the class, and your derived class has a method by the same name and signature, you'll get a warning that you are hiding a parent's method. You will have to use the 'new' keyword to remove the warning.
This functionality is there to help deal with compatibility issues between versions of classes.
Virtual class and members
Virtual basically tells the compiler that the V-Table entry can be overwritten by children.
Difference between Interface and Abstract Class
An Interface cannot implement methods.
An abstract class can implement methods.
An Interface can only inherit from another Interface.
An abstract class can inherit from a class and one or more interfaces.
An Interface cannot contain fields.
An abstract class can contain fields.
An Interface can contain property definitions.
An abstract class can implement a property.
An Interface cannot contain constructors or destructors.
An abstract class can contain constructors or destructors.
An Interface can be inherited from by structures.
An abstract class cannot be inherited from by structures.
An Interface can support multiple inheritance.
An abstract class cannot support multiple inheritance.
simple type aliases a struct type
What's the 'new' 'override' keyword?
Using new
Methods from derived class and base class are separated. Method in derived class behaves like a completely new one. It doesn't implement base class methods(containing same name abstract methods will cause compling error).
Using override
When calling method through a base class pointer to derived class object, override method will find the method in derived class instead of calling method in base class
Thread Safety
Session
AppDomain
Try Catch meaning
Catch will 'catch' Exception, stop excuting current calling and return to former calling point. Otherwise a Unhandled Exception will show up stopping application(hang).
相关文章推荐
- 爬虫学习记录1-基本知识,简单进行网页抓取
- Android学习记录(三十)-- Android 关于手势Gesture的简单实现和实践中遇到的问题。
- 记录学习《0Day安全》路上遇到的问题解决方案: 阶段性总结-重重保护下的堆!
- 【Python3.6爬虫学习记录】(二)使用BeautifulSoup爬取简单静态网页文章
- Python学习记录——基本概念
- JavaWeb学习记录(十九)——jstl自定义标签之简单标签
- 对http和https简单学习记录
- HashMap与Hashtable的区别是面试中经常遇到的一个问题。这个问题看似简单,但如果深究进去,也能了解到不少知识。本文对两者从来源、特性、算法等多个方面进行对比总结。力争多角度、全方位的展示二者的不同,做到此问题的终结版。
- web文件上传一学习记录 (简单的web浏览器可读文件的上传,servlet 文件上传)
- 正则表达式简单学习记录
- ROS探索总结(四)——简单的机器人仿真(by古月)学习遇到的问题
- MOSS Search学习记录(二):配置爬网并尝试一个简单的搜索
- Oracle数据库学习1之简单的理论知识
- 深度学习简单知识
- (记录学习android遇到的问题)使用被weight分配空间后的控件高度值画新控件出现的问题
- [项目过程中所遇到的各种问题记录]目录索引以及简单介绍
- cmake 学习之路 记录中间所遇到过的所有错误与问题的解决 <二>
- Spring MVC学习记录(一)——网站基础知识(1)
- 程序员面试笔试宝典学习记录(五)(操作系统相关知识)
- cadence学习:PCB布局基本知识简单介绍