文件操作

c#中幾個常用代碼string path = @"e:\MyTest.txt";
c#中幾個常用代碼 DateTime dt 
= DateTime.Now;
c#中幾個常用代碼                
if (!File.Exists(path)) 
                }


web應用中的Cache操作
c#中幾個常用代碼Cache cache = System.Web.HttpContext.Current.Cache;
c#中幾個常用代碼
string obj=null;
c#中幾個常用代碼cache.Insert(
"cache1",obj,null,DateTime.Now.AddHours(1),TimeSpan.Zero,CacheItemPriority.AboveNormal,null);
當然對於簡單的字符串,使用以下方式即可
c#中幾個常用代碼Application["Title"= "Test Sample";
c#中幾個常用代碼

cache操作可以放在任何地方,當然放在Global.asax的Application_Start(Object sender, EventArgs e)中最好.

相关文章:

  • 2021-09-09
  • 2022-12-23
  • 2021-05-19
  • 2021-11-03
  • 2021-10-31
  • 2021-08-07
  • 2021-12-07
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2022-01-15
  • 2021-07-29
  • 2022-01-11
  • 2021-06-01
相关资源
相似解决方案