国产探花免费观看_亚洲丰满少妇自慰呻吟_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、接口不能包含字段、構造函數、析構函數、靜態成員或常量。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁阳县| 文登市| 清苑县| 桦川县| 民权县| 北辰区| 乌恰县| 南溪县| 金寨县| 达拉特旗| 苍溪县| 泾源县| 乌拉特后旗| 冀州市| 深泽县| 肃南| 尖扎县| 格尔木市| 河源市| 乌拉特前旗| 新和县| 三门县| 丘北县| 太仓市| 手游| 衡南县| 科技| 寻乌县| 临桂县| 中卫市| 马公市| 峡江县| 衡水市| 黄龙县| 靖州| 绥芬河市| 钟山县| 永仁县| 香格里拉县| 伊金霍洛旗| 武清区|