随笔分类 -  .NET开发

摘要:简单来讲:有符号整数:即有正号和负号无符号整数:即只有正号没有负号举个例子,16位整型数int i; i 为有符号整数,取值范围:-32768——32767unsigned int j; j 为无符号整数,取值范围:0——65535MSDN对Uint64 的描述:表示 64 位无符号整数此 API 不兼容 CLS。兼容 CLS 的替代 API 为 Decimal。但是 无符号整数不兼容CLS为什么呢。按照.Net CLS的定义:NET通过定义公共语言规范(CLS:Common Language Specification),限制了由这些不同引发的互操作性问题。CLS制定了一种以.NET平台为目 阅读全文
posted @ 2012-04-10 11:24 Shikyoh 阅读(24068) 评论(0) 推荐(0) 编辑
摘要:public class Clock { private object obj = new object(); public void RunClock(int Minute) { Thread thread1 = new Thread(() => { int sencond = Minute * 60 / 2; while (sencond > 0) { Di(true)... 阅读全文
posted @ 2012-03-22 14:15 Shikyoh 阅读(1318) 评论(0) 推荐(0) 编辑
摘要:编码规范一 命名空间 <公司名称>.(<产品名称>|<相关技术>)[.<用途>][.<子命名空间>]二 代码风格花括号“{}”不允许省略,即使只有一段代码。不允许省略访问修饰符。类型默认是密封的。不允许公开字段。使用括号“()”来强调运算符优先级。三 命名规范(一) 类、结构和接口的命名使用名词或名词短语。使用Pascal方式。在接口名称前加上前缀“I”。考虑在派生类末尾使用基类的名字。如果该类仅仅为了实现某个接口,那么请保持其与接口命名的统一。如果从.NET 框架中存在的类型派生的类型,应该遵循以下规范:基类派生类System.At 阅读全文
posted @ 2012-03-22 13:29 Shikyoh 阅读(362) 评论(0) 推荐(0) 编辑
摘要:最近没什么事情,复习了下以前几块不熟悉的东西。IEnumerator接口,yield,operatornamespace test{ class Program { static void Main(string[] args) { Console.WriteLine("泛型方法数组遍历"); string[] strList = new string[] { "1", "2", "3", "4", "5" }; ListHelper<string> helper 阅读全文
posted @ 2012-03-16 15:18 Shikyoh 阅读(256) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.Serialization.Formatters.Binary;using System.IO;namespace TestBinaryFormatter{ class Program { static void Main(string[] args) { //序列化 从内存读取信息流 Book book =... 阅读全文
posted @ 2012-03-16 12:09 Shikyoh 阅读(2535) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Runtime.Serialization.Formatters.Binary;namespace CloneClass{ class Program { static void Main(string[] args) { Results set1 = new Results(); Resul... 阅读全文
posted @ 2012-03-16 11:45 Shikyoh 阅读(596) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;namespace LearnDelegate{ class Program { public static void Main(string[] args) { SyncDel del = Calulate; int x = 10; int y = 10; d... 阅读全文
posted @ 2012-03-15 11:05 Shikyoh 阅读(416) 评论(0) 推荐(0) 编辑
摘要:Error message: shows - the Remote Procedure call failed. (Exception from HRESULT: 0x800706BE)windows update 不能检查及安装更新解决方法:1. Disable Windows Update service2. Reboot server3. Rename folderSoftwareDistribution (%systemroot%)4. Change start type for service Windows Update to manual5. run kb 947821 upda 阅读全文
posted @ 2011-12-23 15:16 Shikyoh 阅读(420) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class _Default : Page { protected void Page_Load(object se 阅读全文
posted @ 2011-12-23 13:56 Shikyoh 阅读(863) 评论(0) 推荐(0) 编辑
摘要:1.Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 拒绝访问。 (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).此问题出现有多种原因,要么找不到Com,要么没有权限访问Com需要在Com组件中 配置 Excel Application的安全权限。在Server 2008 64位中 需要 以32访问的方式处 阅读全文
posted @ 2011-12-22 17:31 Shikyoh 阅读(758) 评论(0) 推荐(1) 编辑
摘要:请卸载你的SVN管理插件,如AnkhSvn重装。~~~搞了1小时 ,才找到这个原因· 阅读全文
posted @ 2011-11-16 15:03 Shikyoh 阅读(2443) 评论(0) 推荐(0) 编辑
摘要:public class SLList<T> : IEnumerator { private ArrayList Info; private int Index; public SLList(IEnumerable<T> List) { Index = -1; Info = new ArrayList(List.Count()); foreach (var item in List) { Info.Add(item... 阅读全文
posted @ 2011-11-12 16:57 Shikyoh 阅读(731) 评论(1) 推荐(0) 编辑
摘要:代码优先 public class NewMyClass : IEnumerable, IEnumerator { private string[] Info; private int Index; public NewMyClass(int Size) { Index = -1; Info = new string[Size]; for (int i = 0; i < Size; i++) { Info[i]... 阅读全文
posted @ 2011-11-12 15:57 Shikyoh 阅读(259) 评论(0) 推荐(0) 编辑
摘要:一套完整的 IEnumerator 和IEnumerable 关系 public class MyClass : IEnumerator { public MyClass(int Size) { this.Index = -1; Info = new string[Size]; for (int i = 0; i < Size; i++) { Info[i] = i.ToString(); } } ... 阅读全文
posted @ 2011-11-12 15:49 Shikyoh 阅读(348) 评论(0) 推荐(0) 编辑
摘要:在传统的.net Request验证中 ,只需要在WebConfig HttpRuntime节点 加入 RequestValidateMode 属性,值为2.0(此处2.0并非Framework版本)在pages 或页面中将 validateRequest设为 false 即可。但以上设置在MVC中失效。在MVC中 设置如下:ValidateInput在MVC的 方法 或控制器上 加入 [ValidateInput(false)]标识就OK了但前提是 同样是:WebConfig HttpRuntime节点 加入 RequestValidateMode 属性,值为2.0(此处2.0并非Frame 阅读全文
posted @ 2011-11-11 11:14 Shikyoh 阅读(4681) 评论(1) 推荐(2) 编辑
摘要:今天拿出来Log4net 玩玩。突然 引用Dll后 ,编译不过去了打开 类视图 居然变成了这个检查了半天 发现 原来 和选择的 framework 版本有问题 ,只要 framework版本为 client的 都没法编译通过。看来精简版的 缺少 log4net引用的东西。但大部分默认都是Client版 ,看来以后得注意啊 阅读全文
posted @ 2011-11-02 14:50 Shikyoh 阅读(204) 评论(0) 推荐(0) 编辑
摘要://RichText添加选区 颜色 private void ChangeColor(string text, Color color) { //int s = 0; //while ((-1 + text.Length - 1) != (s = text.Length - 1 + this.txtResult.Find(text, s, -1, RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord))) //{ //... 阅读全文
posted @ 2011-09-20 11:39 Shikyoh 阅读(306) 评论(0) 推荐(0) 编辑
摘要:#region 传统读法 object readOnly = true; object missing = System.Reflection.Missing.Value; object fileName = file.FullName; Microsoft.Office.Interop.Word.ApplicationClass wordapp = new ApplicationClass(); //打开指定文件(不同版本的COM参数个数有差异,一般而言除第一个外都用missing... 阅读全文
posted @ 2011-09-20 11:38 Shikyoh 阅读(382) 评论(0) 推荐(0) 编辑
摘要:1.ToString("00000")在整数型的 ToString方法 重载了个 public string ToString(string format);可设置格式(我不知道有这个)2.保留小数ToString("N2") 阅读全文
posted @ 2011-08-19 11:14 Shikyoh 阅读(818) 评论(0) 推荐(0) 编辑
摘要:Imports SystemImports EnvDTEImports EnvDTE80Imports EnvDTE90Imports EnvDTE90aImports EnvDTE100Imports System.DiagnosticsImports MyCmnImports System.LinqImports System.IOPublic Module Module1 Private ErrMsg As String Private SucessMsg As String Sub Test() End Sub Sub CopyFileToPath() SucessMsg = &quo 阅读全文
posted @ 2011-08-05 16:33 Shikyoh 阅读(999) 评论(0) 推荐(0) 编辑