- 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.
推薦閱讀
- SQL Server 從入門(mén)到項(xiàng)目實(shí)踐(超值版)
- Monkey Game Development:Beginner's Guide
- Python for Secret Agents:Volume II
- SQL Server 2012數(shù)據(jù)庫(kù)技術(shù)及應(yīng)用(微課版·第5版)
- 深入淺出Android Jetpack
- Quarkus實(shí)踐指南:構(gòu)建新一代的Kubernetes原生Java微服務(wù)
- C語(yǔ)言程序設(shè)計(jì)
- Java面向?qū)ο蟪绦蛟O(shè)計(jì)
- Terraform:多云、混合云環(huán)境下實(shí)現(xiàn)基礎(chǔ)設(shè)施即代碼(第2版)
- 一本書(shū)講透Java線(xiàn)程:原理與實(shí)踐
- C++20高級(jí)編程
- Hands-On Neural Network Programming with C#
- Zabbix Performance Tuning
- Android應(yīng)用開(kāi)發(fā)實(shí)戰(zhàn)(第2版)
- 進(jìn)入IT企業(yè)必讀的324個(gè)Java面試題