c#的一些書寫技巧
從非創建線程訪問線程資源
Invoke(new Action<int>((o)=>
{
textBox1.Text = (Convert.ToInt32(textBox1.Text) + o).ToString();
}), new object[] { msg });
wcf channel資料統一管理
string Hello(string words){
var funcHelloWS=new Func<ISPWCFService,string>((iproxy,iwords)=>{
iproxy.HelloWS(iwords);
});
}
-------------------------ClientWrap----------------------
public string HelloWSClient(Func<T,string,string> funHelloWS,string words)
{
string r="";
try{
using(ChannelFactory<T> cfx=GetChannelFactory<T>())
{
T proxy=cfx.CreateChannel();
r=funHelloWS(proxy,words);
}
}
catch(Exception er){
-----------
}
}

浙公網安備 33010602011771號