Search code examples
vb.netcodedompartial-methods

Workaround for VB.NET partial method using CodeDom?


I know CodeDom doesn't support partial methods, but is there a workaround? I found a workaround for C#, but I need one for VB.NET. Thanks.


Solution

  • I ended up detecting the language and using CodeSnippetTypeMember()

    Dim onDeleting = "Partial Private Sub OnDeleting()" & Environment.NewLine & "End Sub"
    type.Members.Add(New CodeSnippetTypeMember(onDeleting))