问题小记
连接到源文件 " E\...\...\Default.aspx.designer.cs " 的撤消管理器时出错.
解决方法: 把文件拷贝出来,关闭VS,再拷贝进去,打开VS就好了.
Json用法:
using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using System.IO;
namespace JsonApplication
{
class Program
{
static void Main(string[] args)
{
Product product = new Product();
product.Name ="apple";
product.Price=12;
product.Sizes = new string[] {"small","medium"};
product.Expiry = new DateTime(2008,12,28);
//输出Json
string output = JsonConvert.SerializeObject(product);
//反序列化
Product deserializedProduct = (Product)JsonConvert.DeserializeObject(output,typeof(Product));
}
}
public class Product
{
private string _name;
private DateTime _expiry;
private double _price;
private string[] _sizes;
public string Name
{
get{ return _name;}
set{ _name = value;}
}
public DateTime Expiry
{
get{return _expiry;}
set{ _expiry = value;}
}
public double Price
{
get{ return _price;}
set{ _price = value;}
}
public string[] Sizes
{
get{ return _sizes;}
set{ _sizes = value;}
}
}
}