Is it possible to automatically insert a Code Snippet when an interface is implemented? If so, how do you do it? I am looking for something similar to when you implement IDispoable in VB.
e.g.
I have the following Interface
Public Interface ITransferable
ReadOnly Property TransferParameters() As Object
End Interface
I also have a Code Snippet as follows
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Transfer Parameter Snippet</Title>
<Author>RMC</Author>
<Description>Transfer Parameter Snippet used when implementing the ITRansferable Interface</Description>
</Header>
<Snippet>
<Code Language="VB" Kind="" Delimiter="$">
<![CDATA[
Private m_oTransferParameters As Object
Public Class InputParameters
'Add Input Parameter declaration/s here
End Class
Public Class OutputParameters
'Add Output Parameter declaration/s here
End Class
Public ReadOnly Property TransferParameters() As Object Implements ITransferable.TranferParameters
Get
Return m_oTransferParameters
End Get
End Property
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
So, what I want to happen, is when the ITransferable Interface is implemented, it injects the code in the code snippet into the class implementing the interface, such as
Public Class NewClass()
Implements ITransferable
Private m_oTransferParameters As Object
Public Class InputParameters
'Add Input Parameter declaration/s here
End Class
Public Class OutputParameters
'Add Output Parameter declaration/s here
End Class
Public ReadOnly Property TransferParameters() As Object Implements ITransferable.TranferParameters
Get
Return m_oTransferParameters
End Get
End Property
End Class
This will be used by web forms when transfering parameters from one page to the next using Server.Transfer