Prescott
Prescott

Reputation: 7412

Partial Classes and Interfaces

Suppose I have the following set up:

Public Interface IA
    Property Name()
    Property Id()
...
End Interface

//Custom File
Partial Public Class A
... Mostly Blank - used for extending the generated file
End Class

//Generated via a tool
Partial Public Class A
... contains properties, methods, etc
    Property Name() ..
    Property Id() ..
End Class

I've added the interface to the custom file, but VS tosses an error at me because the properties are implemented in the generated file. Is there another solution? I'd like to avoid touching the generated partial class.

Thanks, ~P

Upvotes: 0

Views: 720

Answers (1)

Hans Passant
Hans Passant

Reputation: 941625

The generated file needs to use the Implements keyword. Hard requirement in the VB.NET language, there is no workaround for that. That doesn't otherwise have anything to do with partial classes.

Upvotes: 2

Related Questions