- C# 7 and .NET Core 2.0 High Performance
- Ovais Mehboob Ahmed Khan
- 112字
- 2021-08-27 18:47:10
Constant pattern
A constant pattern is a simple pattern that checks for the constant value. Consider the following example: if the Person object is null, it will return and exit the body method.
The Person class is as follows:
class Person { public int ID { set; get; } public string Name { get; set; } public DateTime DOB { get; set; } }
In the preceding code snippet, we have a Person class that contains three properties, namely ID, Name, and DOB (Date of Birth).
The following statement checks for the person object with a null constant value and returns it if the object is null:
if (person is null) return;
推薦閱讀
- 公有云容器化指南:騰訊云TKE實(shí)戰(zhàn)與應(yīng)用
- 數(shù)據(jù)可視化:從小白到數(shù)據(jù)工程師的成長(zhǎng)之路
- SQL Server 2012數(shù)據(jù)庫(kù)技術(shù)與應(yīng)用(微課版)
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場(chǎng)景與數(shù)據(jù)產(chǎn)品
- MongoDB管理與開(kāi)發(fā)精要
- 虛擬化與云計(jì)算
- 工業(yè)大數(shù)據(jù)分析算法實(shí)戰(zhàn)
- Starling Game Development Essentials
- Oracle PL/SQL實(shí)例精解(原書(shū)第5版)
- 重復(fù)數(shù)據(jù)刪除技術(shù):面向大數(shù)據(jù)管理的縮減技術(shù)
- 數(shù)據(jù)庫(kù)原理與應(yīng)用
- 視覺(jué)大數(shù)據(jù)智能分析算法實(shí)戰(zhàn)
- 大數(shù)據(jù)分析:數(shù)據(jù)倉(cāng)庫(kù)項(xiàng)目實(shí)戰(zhàn)
- 數(shù)字IC設(shè)計(jì)入門(mén)(微課視頻版)
- MySQL技術(shù)內(nèi)幕:SQL編程