国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

C#BestPractices-DefineProperClasses

2019-11-14 13:37:30
字體:
來源:轉載
供稿:網友

application Architecture

Define the components apPRopriately for the application and create project for each one.

 

What is Class?

3 Things: Visual Things, Business Things (Domain Entities), Application Things (like Logging & Email Generation)

3 Types: User interface classes, Domain entity classes, Library class

Class is a template or mold,specifies the traits or data,specifies the behavior or Operations.

類是一種模板或模具,指定了具體數據或者是行為操作等。

Unit Testing

3 Advantages:

Higher Code Quality, Faster and Easier Debugging, Repeatable

Features:

Tests the behavior of a unit of code (often a method), Automated, Defined with code,Identifies errors

Tools:

MSTest, NUnit

Steps:

1.Define the test scenarios, 2.Generate the tests, 3.Execute the tests

Arrange -> Act -> Assert

FAQ

1.Why is a layer architecture important?

Logical components are easier to create,change,extend and maintain

Code are easier to reuse

2.What is a class?

A template for the objects created at runtime

Specifies the data and operations for each entity

3.What are the benefits of unit testing?

Higher quality code,faster and easier debugging,and they are repeatable over the life of the application

類定義中的訪問修飾符

無或internal:只能在當前項目中訪問類

public:可以在任何地方訪問類

abstract或internal abstract:不能實例化,只能供繼承之用(只能在當前項目中訪問)

public abstract:同上,但可以在任何地方訪問

sealed或internel sealed:不能供派生之用,只能實例化(只能在當前項目中訪問)

public sealed:同上,但可以在任何地方訪問

接口和抽象類

類似:

都不能實例化,都包含可以由派生類繼承的成員。

區別:

1、派生類只能繼承一個基類,但類可以繼承任意多個接口。

2、抽象類的成員可以擁有代碼體(即代碼實現),而接口成員沒有代碼體,都必須在使用接口的類上實現。

3、接口成員是公共的,而抽象類的成員可以是private, protected, internal or protected internal。

4、接口不能包含字段、構造函數、析構函數、靜態成員或常量。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 彭山县| 三台县| 武定县| 洛南县| 钦州市| 蕉岭县| 陆丰市| 柘荣县| 广灵县| 永胜县| 泽州县| 广元市| 乃东县| 天气| 新绛县| 夏津县| 谢通门县| 海晏县| 旌德县| 高淳县| 长岭县| 山西省| 正阳县| 宜丰县| 博野县| 武陟县| 饶河县| 旺苍县| 怀来县| 阜南县| 平果县| 永清县| 富顺县| 马关县| 乐至县| 奉新县| 自治县| 仁寿县| 色达县| 太保市| 常熟市|