易截截图软件、单文件、免安装、纯绿色、仅160KB

常见算法C#描述

冒泡排序
using System;
class Program
{
public static void Main()
{
int[] a = new int[10];
Random rand = new Random();
for (int i = 0; i < 10; i++)
{
a[i] = rand.Next(10);//生成随机数给数组赋值
}
for (int i = 0; i < 10; i++)
{
Console.Write(a[i]);
}
for(int i=0;i<9;i++)
for (int j = i + 1; j < 10; j++)
{
int temp = 0;
if (a[i] > a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
Console.WriteLine();
for (int i = 0; i < 10; i++)
Console.Write(a[i]);
Console.Read();
}
}


相关文档:

C# 操作 XML 步骤

1.添加命名空间引用
using System.Xml;
2.新建xml实例
public XmlDocument objXmlDoc = new XmlDocument();
3.加载Xml文档
string path=Server.Mappath("demo.xml");//得到文档路径
objXmlDoc.Load(path);//加载文档
4.查找要进行操作的结点
objXmlDoc.SelectNodes(xpath);//得到结点集合
objXmlDoc.SelectSingleN ......

C#删除XML结点的简单例子

接上一篇
删除原genre属性,删除leixing=love的所有结点。
1 原xml文件 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="love" ISBN="1234123">
    <title>who am i </title>
    <author>who</aut ......

C#操作xml

在C#.net中如何操作XML
需要添加的命名空间:
using System.Xml;
定义几个公共对象:
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1,创建到服务器同名目录下的xml文件:
方法一:
xmldoc = new XmlDocument ( ) ;
//加入XML的声明段落
xmlnode = xmldoc.CreateNode ( XmlNodeType.XmlDeclara ......

C#利用webrequest计算待下载的文件大小

C#利用webrequest计算待下载的文件大小
string URL = textBox1.Text;
string filetype = URL.Substring(URL.LastIndexOf(".") + 1, (URL.Length - URL.LastIndexOf(".") - 1));
filetypevalue.Text = filetype.ToUpper();
string filename = URL.Substring(URL.LastIn ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号