locked
How to get collection of strings from a resource file in windows mobile 6.0 using c#? RRS feed

  • Question

  • hi

    how to get collection of strings from a resource file in windows mobile 6.0 using c#.

    i created one resource file in that 12 strings are there .how to retrive at a time all strings.

    Friday, September 24, 2010 3:50 AM

Answers

  • Hi,

    We can code like below to get all string at one time:

    ResourceSet resources = Resources.ResourceManager.GetResourceSet(

    new System.Globalization.CultureInfo("en"), false, true);

     

                IDictionaryEnumerator resourceList = resources.GetEnumerator();

     

                while (resourceList.MoveNext())

                {

                    string key = (string)resourceList.Key;

                    string value = (string)resourceList.Value;

                }

    If you still can't solve it, please let me know.

     

    Best regards,
    Guang-Ming Bian - MSFT

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Monday, September 27, 2010 7:59 AM
  • hi

    how to get collection of strings from a resource file in windows mobile 6.0 using c#.

    i created one resource file in that 12 strings are there .how to retrive at a time all strings.

    In addition to Guang-Ming Bian,

    I come to know another one more solution here in my code I have added two keys and values in Resources.resx File

    like this:

    Keys = Test and SDKName  | Values = testvalue and WM6.0

    here we can directly access the resource file keys.

    "ApplicationNamespace.Properties.Resources.Key"

    Description :

    here SmartDeviceProject1 is a application Name Space then press dot select Properties then press dot select Resources and press dot and select key from resource file.

    Code Snippet

    string strTest = SmartDeviceProject1.Properties.Resources.Test;
    string strValue = SmartDeviceProject1.Properties.Resources.SDKName;

     

    Hope it Helps.


    If you find my post is helpful for you then mark as a answer.
    Monday, September 27, 2010 10:17 AM

All replies

  • Hi,

    We can code like below to get all string at one time:

    ResourceSet resources = Resources.ResourceManager.GetResourceSet(

    new System.Globalization.CultureInfo("en"), false, true);

     

                IDictionaryEnumerator resourceList = resources.GetEnumerator();

     

                while (resourceList.MoveNext())

                {

                    string key = (string)resourceList.Key;

                    string value = (string)resourceList.Value;

                }

    If you still can't solve it, please let me know.

     

    Best regards,
    Guang-Ming Bian - MSFT

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Monday, September 27, 2010 7:59 AM
  • hi

    how to get collection of strings from a resource file in windows mobile 6.0 using c#.

    i created one resource file in that 12 strings are there .how to retrive at a time all strings.

    In addition to Guang-Ming Bian,

    I come to know another one more solution here in my code I have added two keys and values in Resources.resx File

    like this:

    Keys = Test and SDKName  | Values = testvalue and WM6.0

    here we can directly access the resource file keys.

    "ApplicationNamespace.Properties.Resources.Key"

    Description :

    here SmartDeviceProject1 is a application Name Space then press dot select Properties then press dot select Resources and press dot and select key from resource file.

    Code Snippet

    string strTest = SmartDeviceProject1.Properties.Resources.Test;
    string strValue = SmartDeviceProject1.Properties.Resources.SDKName;

     

    Hope it Helps.


    If you find my post is helpful for you then mark as a answer.
    Monday, September 27, 2010 10:17 AM