简体   繁体   English

在堆栈中使用类(用户控件)

[英]Using a class (User control) in stack

I am sorry if this noob question. 抱歉,这个菜鸟问题。 So we are learning user controls and this bit of code popped up. 因此,我们正在学习用户控件,并且弹出了这段代码。

private Stack<MyFirstUserControl1> _myControls = new Stack<MyFirstUserControl1>();
private int _controlsInstantiated = 0; 

Can you use a class within a Stack? 您可以在Stack中使用类吗? Can anyone explain? 谁能解释? Noob question I'm sure... 菜鸟问题,我敢肯定...

Stack<MyFirstUserControl1>仅表示该集合将为MyFirstControl1类型

堆栈无非就是LIFO队列,因此可以肯定,它只是对象的列表/集合,可以基于后进先出的方式推送和弹出对象,在这种情况下,它是类型MyFirstUserControl1的实例的列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM