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

C#操作xml

引用命名空间:using System.Xml 
1.检查所要操作的xml文件是否存在:
   System.IO.File.Exists(文件路径及名称);
2.得到xml文件:
(1)在asp.net中可以这样得到:
XmlDocument xmlDoc = new XmlDocument();
//导入xml文档
xmlDoc.Load( Server.MapPath("xmlTesting.xml"));
//导入字符串
//xmlDoc.LoadXml("<bookStore> <book id="01" price="3.5元"> 读者</book></bookStore>");
注:Server.MapPath("xmlTesting.xml")此时的xmlTesting.xml文件必须是在当前的解决方案里;同样可以写成完整的物理路径xmlDoc.Load (@"E:"软件学习"测试"myNoteWeb"xmlTesting.xml")
(2)在windForm中 直接用物理路径得到所要操作的xml文件具体实现方法同上
3.创建xml文件:
 XmlDocument xmlDoc = new XmlDocument(); //创建xml文档(实例化一个xml)
XmlNode root = xmlDoc.CreateElement("bookStore");//创建根节点
//创建第1个子结点:
XmlNode bookNode = xmlDoc.CreateElement("book");
bookNode.InnerText = "读者";
//为此节点添加属性
 法1:
 bookPublishNode.SetAttribute("id", "01")
 root.AppendChild(bookNode);
法2:
 XmlAttribute xmlattribute = tempXmlDoc.CreateAttribute("price");
 xmlattribute.Value = "3.5元";
 tempRoot .Attributes .Append (xmlattribute )
 //创建第2个根节点的子结点:
 XmlNode tempBookNode = xmlDoc.CreateElement("tempbook ");
 tempBookNode.InnerText ="文摘";
 root.AppendChild(tempBookNode);


相关文档:

Socket编程(C#)

//Socket基本编程
//服务端:
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
Thread mythread ;
Socket socket;
// 清理所有正在使用的资源。
protected override void Dispose( bool disposing )
{
try
  {   
   socket.Close();//释放资源 ......

使用c#开发mapserver之六styleObj

styleObj用于设置图层的符号。它在classObj中定义,一般于symbolObj一起使用。通过设置styleObj,可以产生千变万化,丰富多彩的地图。
一个简单的styleObj示例:
CLASS
NAME "Primary Roads"
STYLE
SYMBOL "circle"
COLOR 178 114 1
SIZE 15
END #style1
STYLE
SYMBOL "circle"
COLOR 254 161 0
SIZE 7
END #s ......

C#开发XML WebService接口(SOAP)

原文链接:http://www.cnblogs.com/ding0910/archive/2007/07/12/815407.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using BX.Interface; ......

Asp.net(C#)实现验证码功能代码

新建一个专门用来创建验证码图片的页面ValidateCode.aspx
它的后台cs文件代码如下:
PageLoad
复制代码 代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
string checkCode = CreateRandomCode(4);
Session["CheckCode"] = checkCode;
CreateImage(checkCode);
}
其中CreateRand ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号