- 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.
推薦閱讀
- Kibana Essentials
- Java面向?qū)ο笏枷肱c程序設計
- Go語言高效編程:原理、可觀測性與優(yōu)化
- Interactive Data Visualization with Python
- Apache Spark Graph Processing
- Full-Stack React Projects
- Python編程與幾何圖形
- Clojure Reactive Programming
- Java實戰(zhàn)(第2版)
- Hands-On Nuxt.js Web Development
- FFmpeg開發(fā)實戰(zhàn):從零基礎到短視頻上線
- Learning iOS Security
- Java程序設計教程
- 分布式架構(gòu)原理與實踐
- R的極客理想:量化投資篇