当前位置:网站首页>C generic class case
C generic class case
2022-06-25 18:20:00 【No. 1 in Jinan medical applet】
Generic foundation entry class
public class Program
{
public class Static<T> // Generic classes defined
{
int pos;
T[] data = new T[100]; // Define generic arrays
public void Push(T obj) // Into the stack,
{
data[pos++] = obj;
}
public T Pop(T obj) // The stack,
{
return data[--pos];
}
}
static void Main(string[] args)
{
var stack = new Stack<int>();
// It can also be written as :Stack<int> stack=new Stack<int>();
stack.Push(5);
stack.Push(10);
stack.Push(11);
stack.Push(1);
int x = stack.Pop(); //x=5
int y = stack.Pop(); //y=10
int a = stack.Pop(); //a=11
int b = stack.Pop(); //b=1
Console.WriteLine("{0},{1},{2
边栏推荐
- 158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
- 【深入理解TcaplusDB技术】如何实现Tmonitor单机安装
- Dell R530内置热备盘状态变化说明
- 【深入理解TcaplusDB技术】TcaplusDB常规单据
- RMAN备份数据库_管理备份窗口(Backup Window)
- Android Internet of things application development (smart Park) - picture preview interface
- 股票开户找人办比较方便么?在线开户安全么?
- C# asp,net core框架传值方式和session使用
- Fixed frequency and voltage regulation scheme of Qi v1.2.4 protocol
- New typereference usage fastjson[easy to understand]
猜你喜欢
【深入理解TcaplusDB技术】TcaplusDB新增机型
Redis command string
ASP. Net supermarket convenience store online shopping mall source code, for the surrounding distribution system
LeetCode力扣(剑指offer 26-30)26. 树的子结构 27. 二叉树的镜像 28. 对称的二叉树 29. 顺时针打印矩阵 30. 包含min函数的栈
移动端异构运算技术 - GPU OpenCL 编程(基础篇)
深度学习网路模型
使用宝塔来进行MQTT服务器搭建
視覺SLAM十四講 第9講 卡爾曼濾波
【深入理解TcaplusDB技术】单据受理之建表审批
Kotlin of Android cultivation manual - several ways to write a custom view
随机推荐
The Stackies 2022:32个营销技术栈入选
跨境电商亚马逊、eBay、Shopee、Lazada、速卖通、沃尔玛、阿里国际等平台,怎样进行自养号测评更安全?
Are the top ten leading securities companies safe to open accounts
【深入理解TcaplusDB技术】Tmonitor后台一键安装
RMAN备份数据库_重启RMAN备份
【深入理解TcaplusDB技术】单据受理之表管理
Garbage collector and memory allocation strategy
What is the ranking of the top ten securities companies? Is it safe to open a mobile account?
RMAN备份数据库_双重备份备份集(Duplexing Backup Sets)
Android物联网应用程序开发(智慧园区)—— 图片预览界面
Network security algorithm
視覺SLAM十四講 第9講 卡爾曼濾波
Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
股票开户怎么办理?证券开户哪家好 办理开户安全吗
Kotlin of Android cultivation manual - several ways to write a custom view
十大券商的排名是?手机开户安全么?
New characteristics of cultural consumption in the era of digital economy
Slam visuel Leçon 14 leçon 9 filtre Kalman
【深入理解TcaplusDB技术】一键安装Tmonitor后台
微服务介绍