摘要: 主要代码://定义数的下标,根据下标来找规律public void Find30(int i){  if(i == 0)  {    return 1;  }  if(i == 1)  {    return 1;  }  return Find30(i -1) + Find30(i-2);} 阅读全文
posted @ 2010-06-26 09:44 JasonNET 阅读(1565) 评论(0) 推荐(0) 编辑
摘要: 最大公约数:class MyMath{  public int GetMaxDiv(int a, int b)  {    if(a >= b)    {      return getMaxDiv(a,b);    }    else     {      return getMaxDiv(b,a);    }  }   private int getMaxDiv(int a, int b... 阅读全文
posted @ 2010-06-26 09:39 JasonNET 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 这几个是考察个人逻辑思维的,所以希望大家不要再电脑上敲,直接用大脑思考!第一个例子:class A {  public static int x =3;  static A()  {    x = B.y +1;  }}class B{  public static int y = A.x +1;  static B()  {    y=1;  }  public static void Main... 阅读全文
posted @ 2010-06-26 09:33 JasonNET 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 首先打开VS,创建一个Windows Service 程序进入后先点击右键进入代码,编写一个简单的例子(往C盘下写一个名为aa的文本文档,内容为系统时间):namespace WindowsService1{ public partial class Service1 : ServiceBase {    Thread th = null;    public Service1()    {   ... 阅读全文
posted @ 2010-06-25 18:02 JasonNET 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 首先,要先引用一个类库AjaxPro2.dll,然后再页面的后台代码中注册Ajax,并做一个ServerService的类,并在类的方法上贴上[AjaxMethod]的标签AjaxPro.Utility.RegisterTypeForAjax(typeof(ServerService));//注册ServerService类:using System;using System.Data;using... 阅读全文
posted @ 2010-06-24 18:41 JasonNET 阅读(2513) 评论(0) 推荐(0) 编辑
摘要: 大家都知道引用类型是不能直接相加的,要想相加就要进行重载,并且还要在操作符前加上关键字operator ,下面我简单的实现下‘+’的重载。主要代码:public class Person{  private int weight;  public int Weight  {    get{return weight;}    set{weight = value;}  }}... 阅读全文
posted @ 2010-06-24 16:31 JasonNET 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 单体模式的思路:(单体模式在多线程中容易出现被实例化多次的问题,因此要进行双重为空判断来缓解次问题)1.把构造函数的作用域改为私有的,那样外面就不能new2.通过一个类的静态方法得到一个静态实例例如:public class A {  static A a = null;  static A ()  {    Console.WriteLine("创建对象");  }  public static... 阅读全文
posted @ 2010-06-24 16:24 JasonNET 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 工厂模式,通俗的理解是不同的工厂,走的却是同一个流程。主要代码:public interface IFactory{  void GetName();  void Query(string sqlstr);}public class A :IFactory{  public void GetName()  {    Console.WriteLine("执行名称:A");  }  public v... 阅读全文
posted @ 2010-06-24 16:14 JasonNET 阅读(422) 评论(0) 推荐(0) 编辑
摘要: Remoting 是基于TCP连接的,要实现她要先创建一个类库,然后将类库的dll文件引用到服务端和客户端类库的主要代码:创建一个类库叫Compute ,在类库中创建一个接口IComputeICompte的代码:public interface ICompute{  int Mutil(int a, int b);}定义一个Mathes的类,必须继承一个支持远程访问的对象public class ... 阅读全文
posted @ 2010-06-24 15:56 JasonNET 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 新建两个Form程序引用命名空间:using System.Net; using System.Net.Sockets;Server 端:放两个Button和两个TextBox   public partial class Form1 : Form{   Socket s = null;   IPEndPoint iep = null;   byte[] buf = new byte[1024];... 阅读全文
posted @ 2010-06-24 15:35 JasonNET 阅读(13822) 评论(2) 推荐(2) 编辑