Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Constant in Interface

Status
Not open for further replies.

guttaboys

Programmer
Oct 28, 2003
17
NO
I doesn't seem to be allowed to have constants in your interface in C#. How is the best way to work around this??. I have a simple server client solution that sends message to each other to do some operation. I would like every node to understand what kind of operation is asked for (value of operation). (In java you can set contants in the interface, and you are then sure that all objects implementing this, knows the value).

Thomas
 
You can't set constant in an interface (as you've found out). You can't declare static methods/properties, either.

Try creating it as an abstract base class.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top