- 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;
推薦閱讀
- LibGDX Game Development Essentials
- 正則表達式必知必會
- Visual Studio 2015 Cookbook(Second Edition)
- MySQL從入門到精通(第3版)
- Lean Mobile App Development
- 新基建:數據中心創新之路
- 高維數據分析預處理技術
- Solaris操作系統原理實驗教程
- 數據分析師養成寶典
- 數據修復技術與典型實例實戰詳解(第2版)
- Hadoop 3實戰指南
- 區塊鏈+:落地場景與應用實戰
- Mastering ROS for Robotics Programming(Second Edition)
- 實現領域驅動設計
- 云工作時代:科技進化必將帶來的新工作方式