/// <summary> /// ��̬����WebService /// </summary> /// <param name="url">WebService��ַ</param> /// <param name="methodname">������(ģ����)</param> /// <param name="args">�����б�</param> /// <returns>object</returns> public static void InvokeWebService(string url, string methodname, object[] args) { MyMethodDelegate my_delegate = new MyMethodDelegate(CallWebServise.InvokeWebServiceNew); my_delegate.BeginInvoke(url, null, methodname, args, null, null); // return InvokeWebService(url, null, methodname, args); }
/// <summary> /// Returns true if method MyMethod is overridden; False if not. /// We have an overhead the first time this function is called, but the /// overhead is a lot less than using reflection alone. After the first time /// this function is called, the operation is really fast! Yeah! /// This technique works better if IsMyMethodOverridden() should /// be called several times on the same object. /// </summary> public bool IsMyMethodOverridden() { OverriddenCacheStatus v = this.pMyMethodOverridden; switch (v) { case OverriddenCacheStatus.NotOverridden: return(false); // Value is cached! Faaast! case OverriddenCacheStatus.Overridden: return(true); // Value is cached! Faaast! } // We must rebuild cache. // We use a delegate: also if this operation allocates a temporary object // it is a lot faster than using reflection! // Due to "limitations" in C# compiler, we need the type of the delegate! MyMethodDelegate md = this.MyMethod; if (md.Method.DeclaringType == typeof(MyClassBase)) { this.pMyMethodOverridden = OverriddenCacheStatus.NotOverridden; return(false); } this.pMyMethodOverridden = OverriddenCacheStatus.Overridden; return(true); }
public Ihandler() { call_back = null; }