本文整理汇总了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;
}
}
示例2: ClearTest
public void ClearTest()
{
var array = new[] { 1, 2, 3, 4 };
array.Clear();
CollectionAssert.AreEquivalent(new[] { 0, 0, 0, 0 }, array);
}
示例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;
}
示例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);
}
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
示例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));
}
}
示例10: GenericClearTestCase
public void GenericClearTestCase()
{
var array = new[]
{
"test",
"test"
};
array.Clear( 0, 2 );
Assert.AreEqual( null, array[0] );
Assert.AreEqual( null, array[1] );
}
示例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;
}
示例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]);
}
}
}
示例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"]);
}
}
示例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 ) );
}
示例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;
}
}
}
}