反射(
reflection
)是.net
中的重要機制,通過放射,可以在執行時獲得
.net
中每乙個型別(包括類、結構、委託、介面和列舉等)的成員,包括方法、屬性、事件,以及建構函式等。還可以獲得每個成員的名稱、限定符和引數等。有了反射,即可對每乙個型別瞭如指掌。如果獲得了建構函式的資訊,即可直接建立物件,即使這個物件的型別在編譯時還不知道。
/** created by sharpdevelop.
* user: anson.wu
* date: 2007-4-5
* time: 11:39
* * to change this template use tools | options | coding | edit standard headers.
*/using
system;
using
system.reflection;
using
system.data;
namespace
reflectiontest
try;
console.writeline(method.invoke(obj,par));
//呼叫靜態方法
method
=type.getmethod(
"getwelcome");
console.writeline(method.invoke(
null
,null
));
}catch
(exception e)}}
}外部程式集**
/** created by sharpdevelop.
* user: anson.wu
* date: 2007-4-5
* time: 11:36
* * to change this template use tools | options | coding | edit standard headers.
*/using
system;
namespace
reflectlib
public
intadd(
intx,
inty)
public
static
string
getwelcome()}}
關於java反射的一點應用
這裡記錄我在專案中寫的乙個小應用,用在了資料庫的幫助類中,用於將查詢的結果組裝成list返回 不說了,看 public listgetlist string sql,object params,object obj else listlist new arraylist try setmethod....
關於malloc的一點理解
在函式中使用malloc,如果是大的記憶體分配,而且malloc與free的次數也不是特別頻繁,使用malloc與free是比較合適的,但是如果記憶體分配比較小,而且次數特別頻繁,那麼使用malloc與free就有些不太合適了。因為過多的malloc與free容易造成記憶體碎片,致使可使用的堆記憶體...
關於HTTPS的一點理解
通訊使用明文 不加密 內容可能會被竊聽。不驗證通訊方的身份,因此有可能遭遇偽裝。無法證明報文的完整性,所以有可能已經遭到篡改。https http 認證 加密 完整性保護 https是與ssl 安全套接層 組合使用的http協議 http secure 使用ssl之後,請求則變成先和ssl通訊,ss...