緣起:某一設施由幾個部分組成,這些部分的組成不變(系統的高層抽象保持穩定),但每個部分要富於變化。動機(motivation):“一個複雜物件”的建立工作,通常由各個部分的子物件用一定演算法構成;這些部分經常面臨劇烈的變化,但組合演算法卻相對穩定。意圖(intent):將一個複雜物件的構建與其表示相分離,使同樣的構建過程可以建立不同的表示。結構(Structure):協作(Collaborations)應用:abstract class House{}public abstract
string USerID; int MinRemainMold, currMold, RecordMold; public DialogResult showForm(string UserID, int _MinRemainMold, int _currMold, int _RecordMold) { int MinRemainMold_; this.USerID = UserID;
protected 修飾符,要注意,子類所繼承的protected,是屬於自己的,與其他不相干。A 父類,B子類,C子類不管B,C如何修改protected變量,B和C互不影響,如: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static
VB以及C#程式在開啟時往往會提示程式正在運行或者已經開啟,原因大概是進程沒有關掉。下面是一些經驗,使用起來效果還是不錯的。Share一下。VB:Form_Load中添加下面一段檢測是否有開啟該程式: If App.PrevInstance = True Then MsgBox "程式已開啟!" End End If離開介面時:Private Sub mnuExit_Click() Unload Me EndEnd SubC#:
1.使用者控制項本身就是一種特殊控制項,完全可以像其他控制項那樣拖放到頁面上。2.以編程方式訪問使用者控制項在頁面中加入以下語句訪問使用者控制項:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> TextBox tb = Userlogin1.FindControl("txtUserID") as TextBox;
public string SomeProperty{// get 訪問器不帶參數,且必須返回屬性聲明的類型get{return"This is the property value";}// set訪問器也不帶任何顯示參數,但是編譯器假定它帶一個參數,其類型也與屬性相同,並表示為valueset{// do whatever needs to be done to set the property}} privatestring foreName;publicstring