#副標=Visual Studio 2005新功能系列(13) #大標=Visual Studio 2005操作密技 #作者=文/沈炳宏 ===程式1 <box>=========== myFile.rsp內容 /r:myAssembly.dll /r:myOtherAssembly.dll /nostdlib+ wincv @myFile.rsp ==<box>=========== ==程式2 <box>=========== Imports System.ComponentModel Public Class Class1 Inherits Component End Class ==<end>============== ==程式3 <box>=========== #Const MySpecialCondition = True Class SomeClass <Conditional("MySpecialCondition")> _ public Sub SomeMethod() End Sub End Class Dim obj as SomeClass obj = new SomeClass() obj.SomeMethod() ==<end>============== ==程式4 <box>=========== public class MyPublisher { EventHandler m_MyEvent; public event EventHandler MyEvent { add { m_MyEvent += value; } remove { m_MyEvent -= value; } } } ==<end>============== ==程式5 <box>=========== Public Class MyPublisher Event m_MyEvent As EventHandler Public Custom Event MyEvent As EventHandler AddHandler(ByVal value As EventHandler) AddHandler m_MyEvent,value End AddHandler RemoveHandler(ByVal value As EventHandler) RemoveHandler m_MyEvent,value End RemoveHandler RaiseEvent(ByVal sender As Object, ByVal ea As EventArgs) RaiseEvent m_MyEvent(sender,ea) End RaiseEvent End Event End Class ==<end>============== ==程式6 <box>=========== Imports System.Threading Public Class Form1 Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim currentThread As Thread = Thread.CurrentThread Dim threadName As String = "執行緒1" currentThread.Name = threadName MessageBox.Show("測試執行緒") End Sub End Class ==<end>==============