Constant Trees and Subtrees in .NET

T

tekiegreg

Hey there, what kind of structure is best for building a Constant tree/
subtree mix, for example if the following values would be constant:

Readings.OpenReading
Readings.CloseReadings
Discounts.EmployeeDiscount
Discounts.PoliceDiscount

etc...

What would be the best structure to build for this model so I could
read keys and subkeys of a given item? I've tried enumerations but
couldn't quite figure out how it works in nesting below (for example
you can enumerate "Readings" but not "OpenReading", thanks!
 
P

PlatinumBay

tekiegreg,

You might consider creating classes with constants, and grouping them in a
namespace, such as:

Namespace Consts
Public Class Readings
Public Const OpenReading As Integer = 15
Public Const CloseReadings As Integer = 31
End Class

Public Class Discounts
Public Const EmployeeDiscount As Double = 15
Public Const PoliceDiscount As Double = 17.5
End Class
End Namespace

Hope this helps,


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top