04 2013 档案
摘要:代码是Java转过来的,变量名都没有改……有空再整理一下好了。publiclongtoDecimal(stringinput,longbs){try{longBigtemp=0,temp=1;intlen=input.Length;for(inti=len-1;i>=0;i--){if(i!=len-1)temp*=bs;longnum=changeDec(input[i]);Bigtemp+=temp*num;}returnBigtemp;}catch{return0;}}//十进制转换中把字符转换为数staticintchangeDec(charch){intnum=0;if(ch&
阅读全文
摘要:引入System.Runtime.Serialization.Json命名空间使用 DataContractJsonSerializer类实现序列化序列化类:PeopleCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> public class People { public int Id { get; set; } public string Name { get; set...
阅读全文
摘要:public static class ObjectExtension { public static T Convert<T>(this object target) { T result = default(T); if (target != null) { result = (T)System.Convert.ChangeType(target, typeof(T), CultureInfo.InvariantCulture); } ...
阅读全文
摘要:原贴地址:http://www.soaspx.com/dotnet/csharp/csharp_20110506_7607.htmlCultureInfo简述CultureInfo类位于System.Globalization命名空间内,这个类和这个命名空间许多人都不了解也认为不需要太多了解,实际上,你写的程序中会经常间接得使用这些类。简单的说:当进行数字,日期时间,字符串匹配时,都会进行CultureInfo的处理,也就是不同的CultureInfo下,这些操作的结果可能会不一样。这里要介绍一下非常容易被忽视的InvariantCulture。通过示例了解InvariantCulture前面
阅读全文
摘要:先来个C#版的: public class DESHelper { /// <summary> /// DES加密算法 /// </summary> /// <param name="encryptString">要加密的字符串</param> /// <param name="sKey">加密码Key</param> /// <returns>正确返回加密后的结果,错误返回源字符串</returns> public static string ToDESEn
阅读全文