locked
how to access or get reference of generic ienumerable into another class

    Question

  • hi i want to access this Ienumerable into another class then i want to send to my javascript project:

    public static IEnumerable<NR_TASK_TYPES> SelectQ()
            {
                 var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "NSqlite.db3");
                 using (var db = new SQLite.SQLiteConnection(dbpath))
                 {
                      return db.Query<NR_TASK_TYPES>("SELECT TASK_TYPE_ID, NAME from NR_TASK_TYPES WHERE RULES = 'D'");
                 }
            }
            
            public class NR_TASK_TYPES
            {
                string TASK_TYPE_ID { get; set; } string NAME { get; set; }
            }

    i am new in .net coding so guys help me to access it into another class.
    Wednesday, March 19, 2014 2:19 PM

Answers

  • You will need a reference to an object of the class type and then can then call the Property that you need on it.

    How to get the reference is very specific to your app and how your data is laid out.

    --Rob

    Friday, March 21, 2014 3:01 AM
    Owner

All replies

  • You can provide it as a public property from your class. The other class can then access it via that property if it has a reference to an object of your class. How to get that reference depends on the app and how it uses the class. If it is a singleton class then you can provide a static method which returns the single instance. This is demonstrated with the MainPage.Current method in the Windows SDK app samples available in the code gallery (follow the "samples" link at the top of the page if you're reading this in the Windows Store dev center)
    Wednesday, March 19, 2014 2:41 PM
    Owner
  • its a normal class, can you a bit elaborate it! i am not getting what to do
    Wednesday, March 19, 2014 5:39 PM
  • You will need a reference to an object of the class type and then can then call the Property that you need on it.

    How to get the reference is very specific to your app and how your data is laid out.

    --Rob

    Friday, March 21, 2014 3:01 AM
    Owner