473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Getting List of Strings

Say I have a Resources file I created, I.e., Add New Item... Resources
File

In this file, I have specified a varied of Name / Value pairs.

Now, in my code, I want to be able to 'get' a list of the Names, and perhaps
also the list of the associated Values... how might I accomplish this in c#?

TIA-

Aug 14 '08 #1
3 1084
On Thu, 14 Aug 2008 10:50:18 -0700, Martin <ni**@try.comwrote:
Say I have a Resources file I created, I.e., Add New Item... >
Resources File

In this file, I have specified a varied of Name / Value pairs.

Now, in my code, I want to be able to 'get' a list of the Names, and
perhaps also the list of the associated Values... how might I accomplish
this in c#?
How did you create the "Resources file"? Have you looked at the
ResourceReader class? It may do what you want.

Pete
Aug 14 '08 #2
On Thu, 14 Aug 2008 11:17:23 -0700, Peter Duniho
<Np*********@nnowslpianmk.comwrote:
On Thu, 14 Aug 2008 10:50:18 -0700, Martin <ni**@try.comwrote:
>Say I have a Resources file I created, I.e., Add New Item... >
Resources File [...]

How did you create the "Resources file"? Have you looked at the
ResourceReader class? It may do what you want.
Sorry, you can ignore my first question. :) I think ResourceReader is
the class you want.
Aug 14 '08 #3
Thanks for the pointer!

It goes something like this:

System.Reflection.Assembly a =
System.Reflection.Assembly.GetExecutingAssembly();

System.IO.Stream s =
a.GetManifestResourceStream("MyNamespace.MyResourc eName.resources");

System.Resources.ResourceReader rr = new
System.Resources.ResourceReader(s);
System.Collections.IDictionaryEnumerator en =
rr.GetEnumerator();

while(en.MoveNext())
{
Debug.WriteLine(en.Key);
Debug.WriteLine(en.Value);
}
Aug 14 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Timothy Babytch | last post by:
Hi all. I have a list that looks like , , ] I try to make it flat one: How can I archieve such an effect with list comprehension? Two cycles did the job, but that way did not look pythonic.....
9
by: fudmore | last post by:
Hello Everybody. I have a Segmentation fault problem. The code section at the bottom keeps throwing a Segmentation fault when it enters the IF block for the second time. const int...
5
by: Someone | last post by:
I wish to use a sorted list to store lists of strings. I am unsure as to how things work. I want to do something like: SortedList list = new SortedList(); for(...loop for string...) { if( !...
27
by: Tripper | last post by:
Which is the better way to go and why? //trivial example List<string> strings = GetStrings(); foreach (string s in strings) { // some operation; } strings.ForEach(
5
by: Jimp | last post by:
Why can't I cast List<MyObject> to ICollection<IMyObject>. MyObject implements IMyObject, and of course, List implements ICollection. Thanks
36
by: Chuck Faranda | last post by:
I'm trying to debug my first C program (firmware for PIC MCU). The problem is getting serial data back from my device. My get commands have to be sent twice for the PIC to respond properly with...
6
by: rishabhshrivastava | last post by:
Hey All, Can someone suggest me a way to get the values of CheckBox(es) selected in a CheckBoxList control using JAVASCRIPT. I am pasting my current code gere but its not working need some...
9
by: Paul | last post by:
Hi, I feel I'm going around circles on this one and would appreciate some other points of view. From a design / encapsulation point of view, what's the best practise for returning a private...
4
by: mh | last post by:
I want to iterate over members of a module, something like: for i in dir(x): if type(i) == types.FunctionType: ... but of course dir() returns a list of strings. If x is a module, how can I...
6
by: dudeja.rajat | last post by:
Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues(): self.cbAnalysisLibVersion(END, item) where __libVerDict is a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.