Results 1 to 4 of 4

Thread: How do i create a new resource reader(c#)

  1. #1
    Join Date
    Apr 2009
    Posts
    91

    How do i create a new resource reader(c#)

    I would like to know that how do i create a new resource reader(c#). Does any body knows about it that how can i do so? Can any body help me out in order to create a new resource reader(c#)? Any kind of information on the above issue would be appreciated.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How do i create a new resource reader(c#)

    The following code sample will help you to create shows how to create a Data Reader.
    public static SqlDataReader ReturnReader(string Query)
    {
    string ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["Connection String"].ConnectionString;
    SqlConnection con = new SqlConnection(ConnectionString);
    SqlCommand command = new SqlCommand();

    command.Connection = con;
    command.Connection.Open();
    command.CommandText = Query;
    return command.ExecuteReader();
    }

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: How do i create a new resource reader(c#)

    For using a custom resource reader, it is also necessary to create a custom resource set and a custom resource manager. However, doing this is not a hard task, because you can derive the custom classes from existing classes.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How do i create a new resource reader(c#)

    The following code for example defines a new instance of the ResourceReader class that will read from the specified stream. The code then retrieves an enumerator, iterates through the stream, and prints key/value pairs to the console.

    using System;
    using System.Resources;
    using System.Collections;
    using System.IO;

    public class ReadResources
    {
    public static void Main(string[] args)
    {
    // Create a file stream to encapsulate items.resources.
    FileStream fs = new FileStream("items.resources", FileMode.Open);

    // Open a resource reader to read from the stream.
    IResourceReader reader = new ResourceReader(fs);

    // Get an enumerator for the reader.
    IDictionaryEnumerator en = reader.GetEnumerator();

    // Enumerate through the file, printing out the key/value pairs.
    while (en.MoveNext())
    {
    Console.WriteLine();
    Console.WriteLine("Name: {0}", en.Key);
    Console.WriteLine("Value: {0}", en.Value);
    }
    fs.Close();
    reader.Close();
    }
    }

Similar Threads

  1. Replies: 8
    Last Post: 08-05-2012, 12:46 PM
  2. Replies: 4
    Last Post: 21-08-2010, 04:03 AM
  3. Replies: 6
    Last Post: 13-07-2010, 05:48 PM
  4. Kindle vs Nook reader vs Sony reader
    By Bon-Z in forum Polls & Voting
    Replies: 5
    Last Post: 14-12-2009, 11:46 PM
  5. How to create popup bulloon in acrobat reader
    By Avanindra in forum Windows Software
    Replies: 3
    Last Post: 19-05-2009, 11:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,105,478.14258 seconds with 16 queries