Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

In C#, partial class definitions look like this:

...

Code Block
languagecsharp
partial class Class1
{

...


    public void Method1

...


    {
        // code to implement Method1

...

    }
}
 

...


partial class Class1
{

...


    public void Method2

...


     // code to implement Method2

...


    }
}

In Visual Basic, the same example looks like this:

Code Block
languagevb
Partial Public Class

...

 Class1
    Public Sub Method1
        ' Code to implement Method1
    End Sub
End Class
 
Partial Public Class Class1
    Public Sub Method2
        ' Code to implement Method2
    End Sub
End Class

In either case, you can enable active generation by generating the code for Method1, while keeping the handcrafted code for Method2 in a separate file, untouched by CodeSmith Generator. At compile time, the appropriate compiler will knit the two files together into a single unified class.