Greating Global Enumerations

philprice

Centurion
Joined
Mar 21, 2003
Messages
116
Location
Hull, UK
This is for VB.NET really but i guess it applys to all languages

How do you create global enumerations, i want to create "types" for RSS fields containing 3 bits of data ("all strings"), whats the best way to do this, or is it better to create global classes with the data etc?

The program just basically basses an XPathNavigator to something that will figure out what type it is (by looking at the nodes, uri etc)
 
Create a public enumeration in any of your classes, then reference it using its fully designated name:

Visual Basic:
Public Class Class1
	Public Enum Numbers
		One = 1
		Two = 2
		Three = 3
		Four = 4
		Five = 5
	End Enum
End Class


Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MessageBox.Show(ReturnANumber().ToString, "")
    End Sub

    Private Function ReturnANumber() As Class1.Numbers
        Return [b]Class1.Numbers.One[/b]
    End Function
End Class
 
Back
Top