google 序列化、反序列化
http://blog.csdn.net/chinacsharper/article/details/36628761
http://blog.csdn.net/chinacsharper/article/details/36628761
解决方案 »
- 请问如何获得集合中最大的那个数
- 问一个读取Word表格程序部署环境的问题
- 求救
- string 如何转换为 IHTMLDocument2 ?
- 水晶报表到底好不好用,大家发表看法。。。
- 如果控件的长度超出窗体边界将会被剪切掉,如何使控件长度超过窗体边界时仍能正常显示?
- c#中类的问题,请高手指点
- SharpZipLib如何将文件压缩成为tar类型的
- 这段正则匹配有问题各位看一下
- 如何根据System.Type进行强类型转换
- .NET Framework主要由公共语言运行时(CLR)和基础类库(BCL)两部分组成。请问常用的类(比如Console类)是不是就在基础类库(BCL)里面?
- c#根据坐标给文本框赋值的代码
root.Save(filePath);
string pathout="C:\\test.txt";
StreamWriter sw= new StreamWriter(pathout ,true );
string[] time=new string[3] {"xxx", "xxxx", "xxxxx"};
for (int i = 0; i <= time.Length; i++)
{
sw.WriteLine(time[i] + " ");
}
sw.Close();
sw.Dispose();
http://www.cnblogs.com/akwwl/p/3240813.html
使用遍历数组,linq to xml 拼接xml节点并保持写入xml文件;
StreamWriter sw = new StreamWriter("c:\\result.txt");
//----------------------------------------------------------------------------------------------------------------
using System;
using System.IO;class Test
{
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
if (!File.Exists(path))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("Hello");
sw.WriteLine("And");
sw.WriteLine("Welcome");
}
} // Open the file to read from.
using (StreamReader sr = File.OpenText(fileName))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
} try
{
string path2 = path + "temp";
// Ensure that the target does not exist.
File.Delete(path2); // Copy the file.
File.Copy(path, path2);
Console.WriteLine("{0} was copied to {1}.", path, path2); // Delete the newly created file.
File.Delete(path2);
Console.WriteLine("{0} was successfully deleted.", path2);
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
}------------------------------------------------------------------------------------------------------------
string[] myStr = new string[3] { "Holman是单身狗\r\n", "Holman是哭狗\r\n", "Holman是热狗\r\n" };
//创建一个txt文件用Filestream
using (FileStream myDog = new FileStream(@"C:\Users\ASUSpc\Desktop\Holman.txt", FileMode.OpenOrCreate, FileAccess.Write))
{
//convert str[] to byte[]
List<byte> myInfo = new List<byte>();
foreach (string item in myStr)
{
myInfo.AddRange(Encoding.Default.GetBytes(item));
}
byte[] buffer = myInfo.ToArray();
myDog.Write(buffer, 0, buffer.Length);
}
////////入门新狗,代码写得丑,见谅!