ozzy_mra ozzy_mra - 1 year ago 54
C# Question

Make a constant list of some data in application

In my application, i want to have a list like this

Group Kind TableName Condition
----- ---- --------- ----------
sh Send TableA Null
sh New TableB kbsn=0
jn Receive TableC Null

This list must use in whole of my application and it's values always is constant.
Now,how do i define this list in a class in my C# application and how can i read or query from this list?

Answer Source

Create a Class and add fields to it.

Here is a code:

Class MyCustomClass
    public string Group { get; set; }   
    public string Kind { get; set; }  
    public string TableName { get; set; }  
    public string Condition { get; set; }  

Define static list of MyCustomClass and initialize in application at proper place and use it everywhere in application.

static List<MyCustomClass> lstMyCustomClass  = new List<MyCustomClass> { .... };
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download