- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 80字
- 2021-07-02 15:29:14
Working with different data types
Now, let's put a <T> symbol after where it says public class GenericsClass, as follows:
public class GenericsClass<T>
This means that this single class can work equally well with several different data types. Next, enter the following beneath the open curly brace under the preceding line:
private T[] vals;
Enter the following comment directly above this line:
//generic array instance variable
In other words, this will operate equally well on doubles, decimals, integers, and so on.
推薦閱讀
- C++程序設計(第3版)
- Android Studio Essentials
- Learning Apache Kafka(Second Edition)
- 零基礎輕松學SQL Server 2016
- Visual Basic程序設計
- 運用后端技術處理業務邏輯(藍橋杯軟件大賽培訓教材-Java方向)
- SSM開發實戰教程(Spring+Spring MVC+MyBatis)
- Web編程基礎:HTML5、CSS3、JavaScript(第2版)
- Mastering ASP.NET Core 2.0
- Visual C#(學習筆記)
- Building E-Commerce Solutions with WooCommerce(Second Edition)
- Isomorphic JavaScript Web Development
- Python快速編程入門
- Java并發編程深度解析與實戰
- Machine Learning for the Web