当前位置:网站首页>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边栏推荐
- Interrupt operation: abortcontroller learning notes
- 利用Qt制作美化登录界面框
- Is it convenient to open a stock account? Is online account opening safe?
- What is an operator?
- [daily record] - bug encountered during BigDecimal Division
- 【深入理解TcaplusDB技术】单据受理之建表审批
- 跨境电商亚马逊、eBay、Shopee、Lazada、速卖通、沃尔玛、阿里国际等平台,怎样进行自养号测评更安全?
- Introduction to microservices
- 中断操作:AbortController学习笔记
- Solve nvprof error err_ NVGPUCTRPERM - The user does not have permission to profile on the target device.
猜你喜欢

【深入理解TcaplusDB技术】Tmonitor后台一键安装

SQL Server real time backup library requirements

1. Understanding of norm

Handling method of qstring containing "\u0000" in QT

Virtual machine class loading mechanism

What is an operator?

JVM problem replication

Encryption trend: Fashion advances to the meta universe

什么是算子?
![[in depth understanding of tcapulusdb technology] tcapulusdb construction data](/img/64/4d7ec393d8469cdadc89078a8cf4b1.png)
[in depth understanding of tcapulusdb technology] tcapulusdb construction data
随机推荐
Redis趋势—NVM内存
Interrupt operation: abortcontroller learning notes
20 provinces and cities announce the road map of the meta universe
Qinheng ch583 USB custom hid debugging record
【深入理解TcaplusDB技术】TcaplusDB导入数据
How can the self-supporting number evaluation be safer for cross-border e-commerce platforms such as Amazon, eBay, shopee, lazada, express, Wal Mart and Alibaba international?
.NET Worker Service 添加 Serilog 日志记录
什么是算子?
【深入理解TcaplusDB技术】创建游戏区
【深入理解TcaplusDB技术】单据受理之建表审批
快手616战报首发,次抛精华引新浪潮,快品牌跃入热榜top3
IVX 启航
Centos7 installing redis 7.0.2
【深入理解TcaplusDB技术】TcaplusDB业务数据备份
【深入理解TcaplusDB技术】集群管理操作
CentOS7 安装 Redis 7.0.2
IET出席2022世界科技社团发展与治理论坛 为构建国际科技共同体献言献策
Network security algorithm
anaconda下载清华源
Garbage collector and memory allocation strategy