主题:急急急
呈现的目的是用户输入满100条消息后 自动删除超过100的信息的
求教 怎么改下面程序 才能正常显示每条消息
String username=Session["username"].ToString();
String mywords=Request["content1"];
mywords=username+":对"+"所有人"+"说:"+mywords;
Application.Lock();
//Application["talk"]=Application["talk"]+mywords+"<br>";
int del=0;
string[] talk =(string []) Application["talk"];
ArrayList talk_list = new ArrayList();
for(int i=0;i<talk.Length;i++)
{
talk_list.Add(talk[i].ToString());
}
for(int i = 0;i<talk_list.Count;i++)
{
if(talk_list.Count>=100)
{
talk_list.RemoveAt(i);
del=1;
}
}
if(del==1)
{
String [] talk_result = new String [talk_list.Count];
for(int i = 0;i<talk_list.Count;i++)
{
talk_result[i] =talk_list[i].ToString();
}
Application["talk"]=talk_result;
}
Application.UnLock();
求教 怎么改下面程序 才能正常显示每条消息
String username=Session["username"].ToString();
String mywords=Request["content1"];
mywords=username+":对"+"所有人"+"说:"+mywords;
Application.Lock();
//Application["talk"]=Application["talk"]+mywords+"<br>";
int del=0;
string[] talk =(string []) Application["talk"];
ArrayList talk_list = new ArrayList();
for(int i=0;i<talk.Length;i++)
{
talk_list.Add(talk[i].ToString());
}
for(int i = 0;i<talk_list.Count;i++)
{
if(talk_list.Count>=100)
{
talk_list.RemoveAt(i);
del=1;
}
}
if(del==1)
{
String [] talk_result = new String [talk_list.Count];
for(int i = 0;i<talk_list.Count;i++)
{
talk_result[i] =talk_list[i].ToString();
}
Application["talk"]=talk_result;
}
Application.UnLock();