Application.Add、Application.RemoveAt、 Application.Remove、Application.Clear的用法

原创 2011年01月19日 15:13:00

在讲述Application.add的用法前,我们先来看下面这段代码:

 

 

 Application.Add("App1", "Value1");
            Application.Add("App2", "Value2");
            Application.Add("App3", "Value3");
            for (int i = 0; i < Application.Count; i++)
            {
                Response.Write("变量名: " + Application.GetKey(i));
                Response.Write(",值: " + Application[i] + "<p>");
            }

 

======================此段代码输出结果为================

 

变量名: App1,值: Value1

变量名: App2,值: Value2

变量名: App3,值: Value3

 

 

我们再来看下面这段代码:

 Application.Add("App1", "Value1");
            Application.Add("App2", "Value2");
            Application.Add("App3", "Value3");
            for (int i = 0; i < Application.Count; i++)
            {
                Response.Write("变量名: " + Application.GetKey(i));
                Response.Write(",值: " + Application[i] + "<p>");
            }
          
            Application.RemoveAt(1);-------------------------------------------------------------删除了 ("App2", "Value2");

            Application.Remove("App3");----------------------------------------------------删除了 ("App3", "Value3");

            Response.Write("删除两个变量后" + "<br>");
            Response.Write("<Script>alert("+Application.Count+")</script>"); ----------弹出1
            for (int i = 0; i < Application.Count; i++)
            {
                Response.Write("变量名:" + Application.GetKey(i) );
                Response.Write(",值:" + Application[i] + "<p>");
            }
            Application.Clear();

         Response.Write("<Script>alert("+Application.Count+")</script>"); ----------弹出0

   

======================此段代码输出结果为================

变量名: App1,值: Value1

变量名: App2,值: Value2

变量名: App3,值: Value3

删除两个变量后
变量名:App1,值:Value1


   }


到这里,想必大家就知道application里面方法的用法了吧。。现在总结一下:

Application.Add:添加对象

Application.RemoveAt:移除索引对象

Application.Remove:移除名称对象

Application.Clear:清空application

 

How To: Remove Orphaned Web Application Pool Objects from Central Admin

First the long story of how I got here, if you don’t care about it, just skip the next three paragra...

How to Clear the Application Server Cache Without Shutting it Down

How to Clear the Application Server Cache Without Shutting it Down Updated 4.9.2008: It is ofte...

AlertDialog:Unable to add window -- token null is not for an application

在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码   08-07 21:26:43.506: ERROR/Android...

[转]菜单响应(ADD_APPLICATION_MENUITEM_HILITE_HANDLER SetHiliteHandler)

菜单响应函数 2010-10-27 21:09:20标签:MTK菜单函数响应函数高亮函数原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。htt...

ADD_APPLICATION_ 加载资源参数说明

字串资源解析 图片资源解析 视频资源解析 音频资源解析 菜单资源解析过程 其它 10a...
  • sdoat
  • sdoat
  • 2011年01月19日 14:14
  • 2593

AlertDialog显示错误 Unable to add window token null is not for an application

在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码   08-07 21:26:43.506: ERROR/A...

AlertDialog显示错误 Unable to add window token null is not for an application

在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码   08-07 21:26:43.506: ERROR/Android...
  • hwuyule
  • hwuyule
  • 2013年05月15日 11:54
  • 415

How to add a Custom Pull to Refresh in your iOS Application

If you love your iOS Application and like to make sure that branding is consistent throughout then i...

add a new application

  • 2015年01月15日 15:05
  • 267KB
  • 下载

Unable to add window -- token null is not for an application错误的解决方法

 今天自己做一个小程序,给windowManager添加一个view的时候,一直报一个错误: Caused by: android.view.WindowManager$BadTokenExc...
  • killcwd
  • killcwd
  • 2014年06月08日 09:34
  • 489
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Application.Add、Application.RemoveAt、 Application.Remove、Application.Clear的用法
举报原因:
原因补充:

(最多只允许输入30个字)