当前位置: 首页>>代码示例>>C#>>正文


C# System.Clear方法代码示例

本文整理汇总了C#中System.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# System.Clear方法的具体用法?C# System.Clear怎么用?C# System.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Convert

    public static void Convert(System.Data.DataSet ds, System.Web.HttpResponse response, string ExcelName)
    {
        try
        {
            //first let's clean up the response.object
            response.Clear();
            response.Charset = "";
            //set the response mime type for excel

            response.ContentType = "application/vnd.ms-excel";
            //create a string writer
            //response.AddHeader("Content-Disposition", "attachment;filename=Shilpa.xls");

            response.AddHeader("Content-Disposition", "attachment;filename=" + ExcelName + ".xls");

            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            //create an htmltextwriter which uses the stringwriter
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            //instantiate a datagrid
            System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();
            //set the datagrid datasource to the dataset passed in
            dg.DataSource = ds.Tables[0];
            //bind the datagrid
            dg.DataBind();
            //tell the datagrid to render itself to our htmltextwriter
            dg.RenderControl(htmlWrite);
            //all that's left is to output the html
            response.Write(stringWrite.ToString());
            response.End();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
开发者ID:BInny1,项目名称:United-Car-Exchange,代码行数:35,代码来源:DataSetToExcel.cs

示例2: ClearTest

        public void ClearTest()
        {
            var array = new[] { 1, 2, 3, 4 };
            array.Clear();

            CollectionAssert.AreEquivalent(new[] { 0, 0, 0, 0 }, array);
        }
开发者ID:danislu,项目名称:dotnetUtils,代码行数:7,代码来源:ArrayExtensionsTests.cs

示例3: PrepareResponse

 public void PrepareResponse(System.Web.HttpResponse httpResponse)
 {
     httpResponse.Clear();
     httpResponse.ContentType = "text/csv";
     httpResponse.AddHeader("content-disposition", "attachment; filename=\"" + "export" + ".csv\"");
     httpResponse.BufferOutput = false;
 }
开发者ID:gkomorowska,项目名称:MVCGrid.Net-with-Post,代码行数:7,代码来源:CsvRenderingEngine.cs

示例4: GenerateHTML

        /// <summary>
        /// Generates the pachube embeddable graph. 
        /// </summary>
        /// <seealso cref="http://pachube.github.com/pachube_graph_library/"/>
        /// <param name="alContent">The Embeddable HTML content.</param>
        public static void GenerateHTML(System.Collections.ArrayList alContent)
        {
            string update = GraphFunctionality.AutoUpdate.ToString().ToLower();
            string rolling = GraphFunctionality.Rolling.ToString().ToLower();
            try
            {
                alContent.Clear();
                foreach (string ID in PachubeData.TOTAL_DATASTREAM_ID)
                {
                    string EmbeddableHTML =
                        "<div id=\"graph\" class=\"pachube-graph\" pachube-resource=\"feeds/" + AlarmByZones.Alarm.UserData.Pachube.feedId + "/datastreams/" + ID +
                        "\" pachube-key=\"" +
                        AlarmByZones.Alarm.UserData.Pachube.apiKey + "\" pachube-options=\"timespan:" +
                        Pachube.EmbeddableGraphGenerator.GraphFunctionality.DEFAULT_TIMESPAN[0] +
                        ";update:"+update+";rolling:"+rolling+";background-color:#FFFFFF;line-color:#FF0066;grid-color:#EFEFEF;" +
                        "border-color:#9D9D9D;text-color:#555555;\" style=\"width:" +
                        Pachube.EmbeddableGraphGenerator.GraphAppearance.WIDTH +
                        ";height:" + Pachube.EmbeddableGraphGenerator.GraphAppearance.HEIGHT +
                        ";background:#F0F0F0;\">Graph: Feed " + AlarmByZones.Alarm.UserData.Pachube.feedId +
                        ", Datastream 1</div><script type=\"text/javascript\" " +
                        "src=\"http://beta.apps.pachube.com/embeddable_graphs/lib/PachubeLoader.js\"></script>";

                    alContent.Add(EmbeddableHTML);
                    alContent.Add("<br/>");
                }
                alContent.Add("<br/>");
                alContent.Add("Reference material from: <a href=\"http://pachube.github.com/pachube_graph_library/ \">Pachube graphic library.</a>" + "");
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
开发者ID:RasmusTG,项目名称:HomeAlarmPlusPi,代码行数:38,代码来源:EmbeddableHTML.cs

示例5: ExportToCsv

        public static void ExportToCsv(System.Web.HttpResponse response, DataTable exportData, string exportName)
        {
            response.Clear();
            byte[] BOM = { 0xEF, 0xBB, 0xBF }; // UTF-8 BOM karakterleri
            response.BinaryWrite(BOM);
            StringBuilder sb = new StringBuilder();
            foreach (DataColumn dc in exportData.Columns)
            {
                sb.Append((char)(34) + dc.ColumnName + (char)(34));
                sb.Append(";");
            }
            sb = sb.Remove(sb.Length - 1, 1);
            sb.AppendLine();
            foreach (DataRow dr in exportData.Rows)
            {

                for (int i = 0; i < exportData.Columns.Count; i++)
                {
                    sb.Append(dr[i].ToString().Replace(';', ',').Replace('\n', ' ').Replace('\t', ' ').Replace('\r', ' '));
                    sb.Append(";");
                }
                sb = sb.Remove(sb.Length - 1, 1);
                sb.AppendLine();
            }
            response.ContentType = "text/csv";
            response.AppendHeader("Content-Disposition", "attachment; filename=" + exportName + ".csv");
            response.Write(sb.ToString());
            response.End();
        }
开发者ID:hacikaraa,项目名称:Goldepus,代码行数:29,代码来源:Export.cs

示例6: NeuLaden

        public static IEnumerable<Todo> NeuLaden(System.Collections.ObjectModel.ObservableCollection<Todo> todos = null)
        {
            if (todos != null) todos.Clear();

            var todoService = new TodoService.TodoServiceClient();
            var loadedTodos = todoService.All().Select(t => new Todo(t)).ToList();

            return loadedTodos;
        }
开发者ID:halllo,项目名称:StpNtp,代码行数:9,代码来源:Todo.cs

示例7: Draw

		public override void Draw(System.Drawing.Graphics gr) {
			gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
			gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
			gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			gr.Clear(System.Drawing.Color.White);
			foreach (Vertex v in vertexes)
				v.Draw(gr);
			foreach (Edge e in edges)
				e.Draw(gr);
		}
开发者ID:Raixur,项目名称:BeGraph,代码行数:10,代码来源:Graph.cs

示例8: WriteFile

 protected override void WriteFile(System.Web.HttpResponseBase response)
 {
     response.Clear();
     response.AddHeader("content-disposition", "attachment; filename=" + DownloadedFilename);
     response.ContentType = this.ContentType;
     response.WriteFile(Path);
     response.Flush();
     System.IO.File.Delete(Path);
     response.End();
 }
开发者ID:ysminnpu,项目名称:OpenLawOffice,代码行数:10,代码来源:DeletingFileResult.cs

示例9: ReadSections

 /// <summary>
 /// 读取指定节下的所有键值对
 /// </summary>
 /// <param name="path"></param>
 /// <param name="section"></param>
 /// <param name="values"></param>
 public static void ReadSections(string path, string section, System.Collections.Specialized.NameValueCollection values)
 {
     System.Collections.Specialized.StringCollection keys = new System.Collections.Specialized.StringCollection();
     ReadSections(path, section, keys);
     values.Clear();
     foreach (string key in keys)
     {
         values.Add(key, ReadIniValue(path, section, key));
     }
 }
开发者ID:jxdong1013,项目名称:archivems,代码行数:16,代码来源:IniUtil.cs

示例10: GenericClearTestCase

        public void GenericClearTestCase()
        {
            var array = new[]
            {
                "test",
                "test"
            };
            array.Clear( 0, 2 );

            Assert.AreEqual( null, array[0] );
            Assert.AreEqual( null, array[1] );
        }
开发者ID:MannusEtten,项目名称:Extend,代码行数:12,代码来源:Array.Generic.Clear.Test.cs

示例11: DataTableToWord

 /// <summary>
 /// 把DataTable导出为Word文件
 /// </summary>
 /// <param name="page">Page</param>
 /// <param name="fileName">Word文件名(不包括后缀*.doc)</param>
 /// <param name="dtbl">将要被导出的DataTable对象</param>
 /// <returns></returns>
 public static bool DataTableToWord(System.Web.HttpResponse response, string fileName, DataTable dtbl)
 {
     response.Clear();
     response.Buffer = true;
     response.Charset = "UTF-8";
     response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName + ".doc");
     response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
     response.ContentType = "application/ms-word";
     //page.EnableViewState = false;
     response.Write(DataTableToHtmlTable(dtbl));
     response.End();
     return true;
 }
开发者ID:uwitec,项目名称:web-mvc-logistics,代码行数:20,代码来源:HtmlWordHelper.cs

示例12: RefillCollection

		private static void RefillCollection(string srcValue, System.DirectoryServices.PropertyValueCollection targetValues)
		{
			targetValues.Clear();
			if (string.IsNullOrWhiteSpace(srcValue) == false)
			{
				string[] values = srcValue.Split(';');
				for (int i = values.Length - 1; i >= 0; i--)
				{
					if (string.IsNullOrWhiteSpace(values[i]) == false)
						targetValues.Add(values[i]);
				}
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:13,代码来源:StringCollectionPropertySetter.cs

示例13: logout

 public void logout(bool invalidateSession, HttpRequest request, HttpResponse response, System.Web.SessionState.HttpSessionState session)
 {
     if(!String.IsNullOrEmpty(request.Params["remoteLogout"])){
         session["userAttributes"] = null;
         if(invalidateSession) {
             System.Web.Security.FormsAuthentication.SignOut();
             session.Abandon();
             session.Clear();
         }
     } else {
         if(!String.IsNullOrEmpty(request.Params["ReturnUrl"]))
             response.Redirect(request.Params["ReturnUrl"]);
     }
 }
开发者ID:damianofalcioni,项目名称:saml2-centralized-sp,代码行数:14,代码来源:SPConnector.cs

示例14: ClearTestCase

        public void ClearTestCase()
        {
            Array array = new[]
            {
                "0",
                "1",
                "2"
            };
            array.Clear( 0, 2 );

            Assert.AreEqual( null, array.GetValue( 0 ) );
            Assert.AreEqual( null, array.GetValue( 1 ) );
            Assert.AreEqual( "2", array.GetValue( 2 ) );
        }
开发者ID:MannusEtten,项目名称:Extend,代码行数:14,代码来源:Array.Clear.Test.cs

示例15: GetStringsFromBuffer

 private static void GetStringsFromBuffer(Byte[] buffer, long bufLen, System.Collections.Specialized.StringCollection Strings)
 {
     Strings.Clear();
     if (bufLen != 0)
     {
         int start = 0;
         for (int i = 0; i < bufLen; i++)
         {
             if ((buffer[i] == 0) && ((i - start) > 0))
             {
                 String s = Encoding.GetEncoding(0).GetString(buffer, start, i - start);
                 Strings.Add(s);
                 start = i + 1;
             }
         }
     }
 }
开发者ID:jxdong1013,项目名称:archivems,代码行数:17,代码来源:IniUtil.cs


注:本文中的System.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。