using System;
public class Stack
{
Private Node GetNode(int index){
Node temp = first;
while(index >0){
temp = temp.Next;
index--;
}
return temp;
}
public object this[int index]{
get{
if(!ValidIndex(index))
throw new Exception("");
else
return GetNode(index).Value;
}
set{
if(!ValidIndex(index))
throw new Exception("");
else
GetNode(index).Value = value;
}
}
}class Test
{
static void Main()
{
Stack s = new Stack();
s.Push(1);
s.Push(2);
s.Push(3);
s[0] = 33;
s[1] = 22;
s[2] = 11;
}}
public class Stack
{
Private Node GetNode(int index){
Node temp = first;
while(index >0){
temp = temp.Next;
index--;
}
return temp;
}
public object this[int index]{
get{
if(!ValidIndex(index))
throw new Exception("");
else
return GetNode(index).Value;
}
set{
if(!ValidIndex(index))
throw new Exception("");
else
GetNode(index).Value = value;
}
}
}class Test
{
static void Main()
{
Stack s = new Stack();
s.Push(1);
s.Push(2);
s.Push(3);
s[0] = 33;
s[1] = 22;
s[2] = 11;
}}
解决方案 »
- C# 操作FTP,遇到了一个郁闷问题,程序运行第一次没问题,第二次就报550错误。高手帮忙看看,感激!
- 关于收件箱的实现
- 求大虾们帮个忙,输入框无法输入!在线等.....
- 急!!!!!!!!!!!!!在线等,winfrom的msbuilder的调用问题,以及c#代码实现将一个文件夹作为资源文件夹加入到另一个winform中
- 搜寻一个分割条splitter控件
- Kindeditor 传到.net4.0空间后传图片报服务器发生故障的错误
- 在线等!C# Socket 异步 新建窗口Show()白板.ShowDialog()正常
- BackgroundWorker组件,实现动态任务百分比.传递给GUI上的进度条控件
- GDI 贴图求教各位高手,谢谢!!!
- C#中被get/set方法使用的域叫属性么?
- HttpWebRequest.Accept怎么用?
- DataBinder.Eval(Container.DataItem,"NewsTitle")字符缩短的问题
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/csref/html/vclrfindexedpropertiespg.htm
node类的代码没有