Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hey Everyone,

 

I've created a logEntry Class and I want to be able to support standardized logEntries. I want an enum that will relate to an array or (preferably) a resource file. For example:

 

Public Enum LogEntry
  dbOpen = 1
  dbClosed = 2
End Enum

SomeArray(LogEntry.dbOpen) = "Database Connection Open"

I can think of a few methods for accomplishing this, and wondering if there is a standard practice for accomplishing this or whether it's personal preference ...

 

Method 1:

 

Create the Enum as per above, and in the LogWriteText function, use a select statement to check a property that the user could set to use a default LogEntry, and write the appropriate line to the logfile and then reset the property to 0.

 

Method 2:

Create a collection that the user could use when calling the LogWriteText Function as follows:

 

LogWriteText(colLogEntries(LogEntry.dbOpen))

This method would require a heavy initialization as I would have to cycle through the creation of the collection everytime an instance is created .. seems like overkill ...

 

Method 3:

Use a resource file (not sure how to do this one in VB.NET)

 

 

Thanks for your help!

M.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...