Академический Документы
Профессиональный Документы
Культура Документы
NET API
Developer Technical Services
!ettin" Ac#uainted
The Developer Technical Services Group
200 Autodesk
200 Autodesk
!ettin" Support
http: www!autodesk!com adn"devhelp Provides access to
%n8line kno+led"e 6ase Call su63ission Ne+s"roups
Ans+ers to 9re#uentl( asked #uestions are posted in our on8line kno+led"e 6ase
200 Autodesk
Course %6:ective
#t is to understand: the 9unda3entals o9 the AutoCAD .NET API ho+ to teach (oursel9 the AutoCAD .NET API +here to "et help a9ter+ards What it is not: Teach (ou .NET 9ra3e+ork or C; * '0 pro"ra33in" lan"ua"e !ive (ou co3plete o9 covera"e o9 all API 9unctions
200 Autodesk
Class A"enda
$ectures with $a%s Slides "ive an abstract overvie+ =a6s and discussion "ive a practical perspective $ectures &verview o' !(ET! AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal Bore ,ser Interaction > Advanced Pro3pts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
<
200 Autodesk
Class Schedule
Time ):** " +:** =unch 12D00 8 1D00 Da, %vervie+ o9 .NET 'isual Studio Pro:ect Settin"s > =a6 1 Si3ple ,ser Input > =a6 2 Data6ase 4unda3entals > =a6 $ Bore Data6ase 4unda3entals > =a6 ) Da, . Bore ,ser Input > =a6 ,ser Inter9ace Desi"n > &in9or3 Dialo"s and Palettes > =a6 < Event ?andlin" > =a6 C
200 Autodesk
FuestionsG
200 Autodesk
.NET %vervie+
&hat
0ene9its
I3portant
200 Autodesk
.NET %vervie+
What is !(ET?
Sea3less interaction 6et+een applications and the Internet Access in9or3ation across an(ti3e* an(+here 9ro3 an( device
10
200 Autodesk
.NET %vervie+
What is !(ET?
The .NET 4ra3e+ork used 9or 6uildin" and runnin" all kinds o9
so9t+are* includin" &e686ased applications* s3art client applications* and AB= &e6 Services
Developer tools such as Bicroso9t 'isual Studio .NET A set o9 servers that inte"rate* run* operate* and 3ana"e &e6
11
200 Autodesk
.NET 4ra3e+ork
40 /66 /7 8Script 9 4isual Studio!(ET
12
200 Autodesk
.NET %vervie+
What is !(ET?
(ET 5ramework
(Source: MSDN)
Autodesk Presentation Title 1$
200 Autodesk
.NET %vervie+
Bature lan"ua"e constructs Collections* Events* Dele"ates Co33on pro"ra33in" pit9alls addressed Be3or( 3ana"e3ent* consistent EJception handlin"* uni9ied strin"s
"oes 6e(ond CLL and C%B Beta data allo+s desi"n8 and run8ti3e o6:ect usa"e and eJtension Bultiple supported lan"ua"es > Choose (our +eapons
200 Autodesk
.NET %vervie+
&hat
0ene9its
I3portant
1<
200 Autodesk
.NET %vervie+
0ene'its o' programming in !(ET
Consistent %6:ect %riented Develop3ent plat9or3 Auto3atic 3e3or( 3ana"e3ent > !ar6a"e collection Support 9or 3ultiple lan"ua"es
(Source: MSDN)
Autodesk Presentation Title 1C
200 Autodesk
.NET %vervie+
/onsistent &%>ect &riented Development plat'orm Everything you see can be treated as an Object! Dim m,$ine As (ew $ine<= m,$ine!StartPoint ? (ew Point@d<*A *A *= m,$ine!EndPoint ? (ew Point@d<-*A -*A *= m,$ine!Get/losestPointTo<(ew Point@d<+A +!-A *=A 5alse= Dim ; as #nterger ? B Dim s as String ? ;!ToString<=
%6:ects are instances o9 a Type or C ass -9or eJa3ple m,$ine is an o6:ect and $ine is a t(pe/ %6:ects have properties such as StartPoint* and 3ethods such as Get/losestPointTo<=
1E
200 Autodesk
.NET %vervie+
/onsistent &%>ect &riented Development plat'orm Mature API Constructs
Whats wrong with this function? int acedSS!et-const char M str* const void M pt1* const void M pt2* const struct res6u9 M 9ilter* adsNna3e ss/O
1H
200 Autodesk
.NET %vervie+
/onsistent &%>ect &riented Development plat'orm Mature !"# Constructs So$e % ne& c asses de'ined to encapsu ate acedSS(et() Dim values<.= As T,ped4alue CDe'ine the selection criteria values<*= ? (ew T,ped4alue<D;'/ode!StartA D/ircleE= values<-= ? (ew T,ped4alue<D;'/ode!/olorA -= Dim sel5ilter As (ew Selection5ilter<values= Dim sel&pts As (ew PromptSelection&ptions<= sel&pts!AllowDuplicates ? True C1un the selection Dim res As PromptSelection1esult ? Editor!GetSelection<sel&ptsA sel5ilter=
20
200 Autodesk
.NET %vervie+
0ene'its o' programming in !(ET
Consistent %6:ect %riented Develop3ent plat9or3 Auto3atic 3e3or( 3ana"e3ent -!ar6a"e collection/ and consistent e;ception handling Support 9or 3ultiple lan"ua"es
(Source: MSDN)
21
200 Autodesk
.NET %vervie+
0ene'its o' programming in !(ET
Automatic memory management
CLL 8 Strin" MpNa3ePne+ Strin"-Q?elloQ/ '0 8 Di3 Na3e As Strin" P Q?elloQ C; 8 Strin" Na3ePS?elloTO
22
200 Autodesk
.NET %vervie+
0ene'its o' programming in !(ET
Consistent e)ception hand ing
%ld &a( > '0D Can 6e ver( con9usin" and pro6le3atic@ &n Error GoTo Fne;pectedError Dim ; As Dou%le?-* * C9errorG Fne;pectedError: 3sg0o; StrH<Err!(um%er= Ne+ > '0 .NET Tr, Dim ; As Dou%le?-* * C9error which throws e;ception /atch C9what happened? Division %, IeroG 5inall, C9cleanup " do this either wa, End Tr,
2$
200 Autodesk
.NET %vervie+
0ene'its o' programming in !(ET
Consistent %6:ect %riented Develop3ent plat9or3 Auto3atic 3e3or( 3ana"e3ent -!ar6a"e collection/ and consistent e;ception handling Support 9or 3ultiple lan"ua"es
(Source: MSDN)
2)
200 Autodesk
.NET %vervie+
0ene'its o' programming in !(ET
Support 'or multiple languages
C;* '0 3ost co33onl( used Can interop 6et+een code +ritten in di99erent lan"ua"es. 4or eJa3ple* a class +ritten in C; can 6e inherited 9ro3 a class +ritten in '0@ In 9act* AutoCADIs 3ana"ed asse36lies are +ritten usin" 3ana"ed CLL +hich (ou +ill access 9ro3 '0.NET. No si"ni9icant di99erence in per9or3ance as all lan"ua"es co3pile to I= -Inter3ediate =an"ua"e/ eJecuted 6( the C=5
200 Autodesk
.NET %vervie+
&hat
0ene9its
I3portant
2<
200 Autodesk
.NET %vervie+
#mportant /oncepts Assem%lies V 5undamental unit o' deplo,ment and e;ecution in !(ET Contains a 3ani9est that descri6es the asse36l( V 0oundar, 'or code e;ecution and access permission Asse36l( Bani9est
Na3eG &hat 9iles 3ake up the asse36l(G Dependent asse36liesG 'ersion and CultureG
net3odule
Dlls
03p
(Source: MS !"
Autodesk Presentation Title 2C
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. Auto/AD !(ET 4isual Studio pro>ect settings : Jello WorldG ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal Bore ,ser Interaction > Advanced Pro3pts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
2E
200 Autodesk
ArJ3"d.ch3
Develop3ent Environ3ent
3icroso't 4isual Studio .**L or .**+ Auto/AD .*-* 3icroso't Windows 2P or 3icroso't Windows vista
$0
200 Autodesk
5e9lector
0ro+se .NET asse36lies* disasse36le* deco3pile httpDRRsharptool6oJ.3ad"eek.co3 Disasse36le .NET asse36lies 'isual Studio Tools Dia"nose load ti3e pro6le3s 'isual Studio Tools Check con9or3ance +ith Desi"n !uidelines httpDRR+++."otdotnet.co3Rtea3R9JcopR
Ildas3
4uslo"v
4JCop
$1
200 Autodesk
$2
200 Autodesk
Start +ith a Class =i6rar( application t(pe +ith D== output. Add re9erences to AutoCADIs 3ana"ed asse36lies
acd63"d.dll
Data6ase services and D&! 9ile 3anipulation -like %6:ectD0A/ AutoCAD Application speci9ic -like %6:ectA5A/
ac3"d.dll
4ind the3 in the AutoCAD install 9older -set C%PW =%CA= P 4A=SE/
$$
200 Autodesk
$)
200 Autodesk
Bake a 9unction an AutoCAD co33and 6( addin" an attribute Pu%lic /lass /lassP/ommand3ethod<QJelloWorldQ=R S Pu%lic 5unction JelloWorld<= End 5unction End /lass
Co33andBethod or Co33andBethodAttri6ute t(pe accepts several para3eters in its constructor such as "roup na3e* "lo6al and local na3es* co33and 9la"s and 3ore -,se the o6:ect 6ro+ser/
$
200 Autodesk
!et the editor ob#ect 9or the active docu3ent Dim ed As Editor ?
Application!Document3anager!3diActiveDocument!Editor
Call the editorIs &riteBessa"e 3ethod Pu%lic /lass /lassP/ommand3ethod<QJelloWorldQ=R S Pu%lic 5unction JelloWorld<= ed!Write3essage<QJello WorldQ= End 5unction End /lass
$<
200 Autodesk
%n proJ( detection
TJKEYS$&/A$S3A/J#(EMS&5TWA1EMAutodeskMAuto/ADM1-L!*MA/AD" L**-:O*)MApplicationsMAc$a,erU QDES/1#PT#&(Q?QAuto/AD $a,er 3anagerQ Q$&ADE1Q?Q/:MMProgram 5ilesMMAuto/AD .*-*MMacla,er!dllQ Q$&AD/T1$SQ?dword:*******e Q3A(AGEDQ?dword:*******TJKEYS$&/A$S3A/J#(EMS&5TWA1EMAutodeskMAuto/ADM1-L!*MA/AD" L**-:O*)MApplicationsMAc$a,erM/ommandsU Q$AYE1Q?Q$AYE1Q TJKEYS$&/A$S3A/J#(EMS&5TWA1EMAutodeskMAuto/ADM1-L!*MA/AD" L**-:O*)MApplicationsMAc$a,erMGroupsU QA/$AYE1S/3DSQ?QA/$AYE1S/3DSD
$E
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ Fser #nteraction " Simple Fser #nput and Entit, Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal Bore ,ser Interaction > Advanced Pro3pts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
$H
200 Autodesk
$$$ is the value t(pe +e +ant to pro3pt* such as An"le* Strin"* Distance* Corner etc. ,se Bessa"e and 2e(+ords properties to set the pro3pt strin" and list o9 ke(+ords ,se Allo+%%% to set conditions 9or pro3ptin". &or e'g'( Allow!egati)e
EJa3ples 8 !etAn"le* !etStrin"* !etDistance* !etCorner etc Pass Pro3pt$$$%ptions into !et$$$
)1
200 Autodesk
)2
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data%ase 5undamentals : S,m%ol ta%lesA Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal Bore ,ser Interaction > Advanced Pro3pts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
)$
200 Autodesk
DWG
))
200 Autodesk
Data6ase Structure
DATABASE
R12 SymbolTables
Block Table
Model Space Paper Space Other BTR
Header Variables
Entity
Entity
Entity
200 Autodesk
Data6ase Co3ponents
S(36ol Ta6les
EJa3ples =a(er Ta6le* =inet(pe Ta6le* TeJtst(le Ta6le etc. Containers to store S(36ol Ta6le +ecor,s EJa3ple =a(erTa6le+ecor,* =inet(peTa6le+ecor, etc All S(36ol Ta6les have co33on 3ethods o9 a container such as Add > to add a record Ite3 > to lookup an entr( +ith a search strin" ?as > To kno+ i9 an entr( eJists Is enu3era6le Each s(36ol ta6le can hold onl( records o9 a speci9ic t(pe 4or eJa3ple* a =a(erTa6le can hold onl( =a(erTa6le5ecords
)<
200 Autodesk
Data6ase Co3ponents
0lock Ta6le
0lockTa6le5ecords -0T5/ in turn is a container that holds onl( "raphical entities -i.e.* those derived 9ro3 Entit( t(pe/ T+o de9ault 0lockTa6le5ecords cannot 6e re3oved > Bodel Space and one Paper Space
Searcha6le +ith a strin" or an %6:ectId -3ore on this later/ Neither the 0lock Ta6le nor the S(36ol Ta6les are created 6( the user. The( are created 6( de9ault +hen (ou create a ne+ data6ase.
Create a 6lock de9inition and use ArJD6" or B"dD6" to see +here the 6lock de9inition is stored and peek into its contents
)C
200 Autodesk
Construct %ne
In Be3or(
?ostApplicationServices.&orkin"Data6ase-/
)E
200 Autodesk
)H
200 Autodesk
Transactions
Transactions
Sets the 6oundar( 9or data6ase operations ?andles eJception cleanl( %perates +ith a sin"le ,ndo 9iler Can 6e co33itted > All data6ase operations are saved rolled 6ack > All data6ase operations are a6orted Can 6e nested
200 Autodesk
Nestin" Transactions
1 2
obj2 obj
Transaction 2 Transaction 1
obj1 obj2
obj
-! /lient starts Trans- and gets &%>- W &%>. .! /lient starts Trans. and gets &%>. W &%>@ @! /lient commits Trans. Trans. changes are committed Oa! /lient commits Trans Trans- changes are committed O%! /lient a%orts Trans- instead Trans- <and Trans.= changes are rolled %ack
Autodesk Presentation Title 1
200 Autodesk
Transactions
To start a transaction* use Data6asesI StartTransaction-/ 5or e;ample: Dim d% As Data%ase ? JostApplicationServices!WorkingData%ase<= CGet the current d% used %, Auto/AD Dim trans As Transaction ? d%!Transaction3anager!StartTransaction<= X %egin the transaction
To co33it a transaction* use transactionIs Co33it-/ To A6ort a transaction* use transactionIs A6ort-/ &hen done +ith a transaction it 3ust 6e
e;plicitl, disposedG
200 Autodesk
Transactions
200 Autodesk
200 Autodesk
,se Add 3ethod 9or addin" S(36ol Ta6le 5ecords to add to S(36ol Ta6le ,se AppendAAA to add add other kinds o9 o6:ects to its o+ners 4or eJa3ple
%nce an o6:ect is added to an o+ner* al+a(s let the transaction kno+@ 4or eJa3ple
new0tr!AppendEntit,<circle= CAdd our circle to its owner the 0T1 trans!Add(ewl,/reatedD0&%>ect<circleA True=
200 Autodesk
<
200 Autodesk
Note 3ana"ed o6:ects wrap an un3ana"ed CLL o6:ect@ So +e create the3 +ith Ne+* Do the( need to 6e disposedG
I9 the o6:ect is not in the data6ase >> this ,eletes the underl(in" un3ana"ed o6:ect I9 the o6:ect is in the data6ase > this Closes the underl(in" un3ana"ed o6:ect
I9 opened in a transaction* disposin" or co33ittin" the transaction closes it auto3aticall(@ > Clean 3e3or( 3ana"e3ent.
200 Autodesk
=a6 $
/reate Emplo,ee %lock De'inition
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data%ase 5undamentals : DictionariesA 21ecordsA Ta%le Traversal Bore ,ser Interaction > Advanced Pro3pts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
200 Autodesk
<0
200 Autodesk
Containers to hold data onl( ?olds other Dictionaries ?olds non8"raphical %6:ects -derived 9ro3 D6%6:ect 6ut not D6Entit(@/ Is enu3era6le Each ite3 has a strin" ke( Ite3s searcha6le +ith a strin" ke( usin" !etAt-/ or Ite3 Na3ed %6:ects Dictionar( -N%D/ %+ned 6( the data6ase Availa6le 6( de9ault ,sed to store data6ase level data EJtension Dictionar( %+ned 6( an Entit( Created 6( the user onl( +hen needed ,sed to store entit( level data
<1
200 Autodesk
A5ecord
Data containers ?olds data in a 5es6u9 chain -5esult 0u99er/ 5es6u9 > =inked =ist o9 T(ped'alues -DataT(pe>'alue pair/ No S2e(T to search values +ithin a 5es6u9. Should kno+ the order data is stored in the list A5ecords can 6e added to Dictionaries I9 stored in N%D >data6ase level data I9 stored in EJtension Dictionar( > entit(8level data
<2
200 Autodesk
!et N%D
Di3 d6 P ?ostApplicationServices.&orkin"Data6ase
Di3 N%D As D0Dictionar( P trans.!et%6:ect-d6.Na3ed%6:ectsDictionar(Id* %penBode.4or&rite* 4alse/
<$
200 Autodesk
0lock5e9erences -Inserts/
<)
200 Autodesk
Di3 id As %6:ectId 4or Each id In 6t Di3 6tr As 0lockTa6le5ecord P trans.!et%6:ect-id* %penBode.4or5ead/ NeJt
Autodesk Presentation Title <
200 Autodesk
T(pe in9or3ation -such as constructors* 3ethods* properties* events etc/ are contained in the Betadata Fuer( 3etadata at runti3e usin" t(pes de9ined in S(ste3.5e9lection na3espace
Not onl( to #uer( t(pe in9or3ation 6ut also d(na3icall( create the3. ?eart o9 5e9lection is provided 6( S(ste3.T(pe class The class is a6stract. I3ple3enters need to inherit 3ethods to descri6e the t(pe !et it usin"
<<
200 Autodesk
Castin"M
'0.NET
Castin" is auto3atic 6( assi"n3ent > %nl( i9 %ptionStrict is turned o99 EJplicit castin" > CT(pe- e.pression* type / T(pe%9 > I9 T(pe%9 3(%6:ect is =ine ThenK I9 o6:1.!etT(pe-/ Is o6:2.!etT(pe-/ ThenK
In C;
=ine 3(=ine P -=ine/3(%6:ectO UasI operator 8 =ine 3(=ine P 3(%6:ect as =ineO 8 i9 it 9ails* no eJception* 6ut o6:ect "ets set to null@ UisI operator > i9 -3(%6: is =ine/ K t(peo9 operator > i9 t(peo9 -o6:1/ PP t(peo9-o6:2/K !etT(pe 8 I9 o6:1.!etT(pe-/ PP o6:2.!etT(pe-/ K
=a6 )
Adding /ustom Data
<E
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal 3ore Fser #nteraction : Advanced Prompts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
<H
200 Autodesk
Set *eywor,s
Set efaults
Enter (um%er o' Sides TTriangle SZuare PentagonU P@R: "+ 4alue must %e positive and nonVero!
Pro3pts
T,pes:
Pro3ptPoint%ptions Pro3ptStrin"%ptions Pro3ptDou6le%ptions Pro3ptAn"le%ptions Pro3ptCorner%ptions Pro3ptDistance%ptions Pro3ptEntit(%ptions Pro3ptInte"er%ptions Pro3pt2e(+ord%ptions Pro3ptNestedEntit(%ptions Pro3ptNestedEntit(%ptions Pro3ptSelection%ptions Etc.
C1
200 Autodesk
=a6
Prompts and Selection
C2
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal Bore ,ser Interaction > Advanced Pro3pts Fser #nter'ace design " Win5orm Dialogs and Palettes Event handlin" > 5eactin" to AutoCAD Events in .NET.
C$
200 Autodesk
AutoCAD De9ined
Benus > Application level 3enu* ConteJt 3enu Dialo"s AutoCADIs Enhanced Secondar( &indo+s - Palettes / Color* =inet(pe* =ine+ei"ht* %pen4ile dialo"s Ta66ed Dialo" EJtensions -to %ptions Dialo"/ Status 0ar Tra( Dra"8Drop And 3ore. EJplore Autodesk.AutoCAD.&indo+s na3espace
&indo+s De9ined
&indo+s 4or3s -&in9or3/ ?ost o9 other controls de9ined in C=5
C)
200 Autodesk
,ser Inter9ace
200 Autodesk
=a6 <
Fser #nter'ace Design
C<
200 Autodesk
Class A"enda
$ectures and $a%s
%vervie+ o9 .NET. AutoCAD .NET 'isual Studio pro:ect settin"s > ?ello &orld@ ,ser Interaction 8 Si3ple ,ser Input and Entit( Selection Data6ase 4unda3entals > S(36ol ta6les* Transactions Data6ase 4unda3entals > Dictionaries* A5ecords* Ta6le Traversal Bore ,ser Interaction > Advanced Pro3pts ,ser Inter9ace desi"n 8 &in4or3 Dialo"s and Palettes Event handling : 1eacting to Auto/AD Events in !(ET!
CC
200 Autodesk
?andlin" Events
Event
3essa"e sent 6( an o6:ect to noti9( so3ethin" has happened 3essa"e is received in a 9unction call 6( one or 3ore listeners event sender onl( re#uires 9unction pointer to dispatch a 3essa"e an( interested part( can i3ple3ent the 9unction and receive the event 9unction 3ust have a speci9ic si"nature that the sender re#uires ,se .NET dele"ates to UwireI sender and receiver
Dele"ates
=ike a class -can 6e instantiated/ 6ut +ith a si"nature ?olds re9erences to 9unctions havin" sa3e si"nature =ike UT(pe8Sa9eI 9unction pointer Can encapsulate an( 3ethod +hich 3atches the speci9ic si"nature
CE
200 Autodesk
,sin" Dele"ates
I3ple3ent a 9unction +ith sa3e si"nature Instantiate the dele"ate passin" address o9 the 9unction into its constructor Add the dele"ate instance to senderIs list o9 listeners
Delegate m,Delegate ? new Delegate<address o' m,5unction=[ EventSender!Event 6? m,Delegate[ m,5unction<delegate signature= \ ] DonIt 9or"et to re3ove the listener@
CH
200 Autodesk
=a6 C
Event Jandling
E1
200 Autodesk