Skip to content

How I know that a property is related to a xml file

Guru Call

Asked May 13, 2008, 3:33 AM EDT1 answer
Share
LinkedInX

Hi,

I made a window application in which I put some images, some xml files and some strings in Property.Resources as embedded resources. during run time with the help of Assembly ( using reflection ) I try to access the property which are only of corresponding to xml files so that I can fill my combobox with the Name of the properties which are only related to xml files.

Thanks in advance...

Plz help

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    C#
    public static
    void Retrieve(string
    resPathName)
    {
       
    try
       
    {
            //Create a
    new ResXResource reader and set the resx path to resxPathName
            ResourceReader
    resReader = new ResourceReader(resPathName);
            //Enumerate
    the elements within the resx file and dispaly them
            foreach
    (DictionaryEntry d in
    resReader)
            {
                MessageBox.Show(d.Key.ToString()
    + “ : “ + d.Value.ToString());
            }
            //Close the
    resxReader
            resReader.Close();
            MessageBox.Show(“Done”);
       
    }
       
    //If the resx file represents some
    incoherences
       
    catch (ArgumentException
    caught)
       
    { MessageBox.Show(“Source: “ + caught.Source + “Message: “ + caught.Message); }
    }
    0