473,382 Members | 1,437 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,382 software developers and data experts.

Resource file question!

I am using VS2008 C#3.0 and I would like to know if some one can help
me wiith the following 2 questions;
1. I have a XML file called test.xml file in resource and I would like
to how can I read the xml file wihtout extracting it to a external
file? I would like to load the object into memory and use it from
there.
2. I am planning to have too many data files in the resource file, is
it possible to compress the resource file and then use it?

Thanks.
Mar 21 '08 #1
2 1337
On Fri, 21 Mar 2008 13:53:57 -0700, Peter Duniho
<Np*********@nnowslpianmk.comwrote:
I don't recall the specifics off the top of my head, but it should be
possible to get a MemoryStream from a binary resource. So if you just
treat the XML file resource as a binary resource, you should be able to
wrap that in a MemoryStream and then just read it normally as a regular
stream.
FYI...I took a quick look and sure enough the binary resource shows up as
a regular byte[]. So you can just use the MemoryStream constructor that
takes a byte[] array as the source.
Mar 21 '08 #2
On Fri, 21 Mar 2008 17:54:53 -0700, Jeroen Mostert <jm******@xs4all.nl>
wrote:
I wasn't looking for a fight along the "my idea is better than yours"
divide.
Nor am I. It's just that inexperienced programmers too often get caught
up in the "let's make this optimal" approach that it's worth pointing out
at opportune moments that just because something is more performant, that
doesn't mean it's the best approach.

I don't have a problem with your contribution, but that doesn't mean I
think it should be left without some additional commentary pointing out
that in at least what should be a typical case (ie relatively small
resources), it's likely to be better to choose a simpler option.

I'm sure it wasn't your intent, but describing the alternatives you
suggested as having "saving the overhead..." carries an implication that
it's a better solution in an objective, unqualified way. In fact, of
course, it's only "better" in certain context, context I think was worth
pointing out.
Or a discussion on things that I hope everyone can decide for their own.
When all of the facts, they can.
>But you're right...if someone really wants to get a stream directly,
they can.
Let's promote this to my main point and forget about my ill-advised
dropping of the "o" word, lest I be branded as an optimization bum and
an enemy of simplicity for the rest of my life, which would be a shame.
Yes, indeed. :)

Pete
Mar 22 '08 #3

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

Similar topics

1
by: Gabriel Lozano-Morán | last post by:
First of all sorry for the cross-posting but I am not sure wether this belongs under internationalization or just general. Environment: Visual Studio .NET 2003 Problem: Newly added and...
5
by: Julia | last post by:
Hi, I need to localize my asp.net application and I would like to populate drop down box from a resource file I see that ms localization tool kit can save lists in a resource file but I don't...
8
by: Bonj | last post by:
when creating a resource-only dll, the only way I can get it to compile and work correctly, is to make it a non-resource-only dll. surely this can't be the way...? basically, there is a load of...
2
by: Joe Thompson | last post by:
Hi, I am trying to use PlaySound in a VC++.net Windows app (VS 2003). I can use it to play a file but now I want to play it from a resource. I have two questions: How do I add a wav file to...
1
by: mehdi_mousavi | last post by:
Hi folks, Consider a string that's defined under VS2005 resource editor as myField with the value of myValue. To access the value, I could easily use the Properties.Resources class, for example:...
1
by: John | last post by:
Can some one please help me with this code? I've spend 2 days on it. And I see the question all over the place but I do not see the answer. No on is answering the question I am about to ask. I...
8
by: CodeLeon | last post by:
Hi, All. I am creating a setup program. The way it works is that the user creates their setup info, my program generates the C# code for a setup executable, embeds the xml file containing the info...
7
by: craig | last post by:
....quick question for anyone who might have some experience with .net resource files in VS 2003. I have an application that is not localized, but I would still like to be able to place all of...
12
by: TS | last post by:
i have a need to possibly enable mutli language support. What benefit do i get by using a resource file instead of a custom xml solution? thanks!
0
by: =?Utf-8?B?UGF1bCBIYWdlcg==?= | last post by:
I've been trying to solve this issue for the better part of a month. My attempts to get an answer on the MSDN groups proved to no avail. Here is the situation/problem. I am migrating an old...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.