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

Integer Resources

I want to have a resource file with integers, rather than strings, and
have VS 2008 generate a global object with integer properties, rather
than string properties. Is this possible?

(I know I can convert the values to strings, but I'd like to know if
there's a cleaner solution.)

Thanks

Jul 9 '08 #1
6 5442
Greg,

Add a settings file instead. In that, you can specify the type of the
setting and it will generate the type-safe properties to access the
settings.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Esres" <ge****@boundvortex.comwrote in message
news:91**********************************@b1g2000h sg.googlegroups.com...
>I want to have a resource file with integers, rather than strings, and
have VS 2008 generate a global object with integer properties, rather
than string properties. Is this possible?

(I know I can convert the values to strings, but I'd like to know if
there's a cleaner solution.)

Thanks

Jul 9 '08 #2
Nicholas wrote:

<<Add a settings file instead. *In that, you can specify the type of
the setting and it will generate the type-safe properties to access
the settings.>>

Interesting...I wasn't familiar with this feature. Do you feel this
is an appropriate way to define constants, such as data input field
lengths?

Thanks
Jul 9 '08 #3
Greg,

Well, if they are truly constants, then the value would never change and
you should be defining them in code with const.

For something like data input field lengths, I would think that there is
a better way to do this. I would think that the underlying data store would
have information on the field length which you can query, and not have to
replicate the data (a DB will expose this information, if it is XML, then
you should be able to get it from the schema).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Esres" <ge****@boundvortex.comwrote in message
news:f7**********************************@a70g2000 hsh.googlegroups.com...
Nicholas wrote:

<<Add a settings file instead. In that, you can specify the type of
the setting and it will generate the type-safe properties to access
the settings.>>

Interesting...I wasn't familiar with this feature. Do you feel this
is an appropriate way to define constants, such as data input field
lengths?

Thanks
Jul 9 '08 #4
Nicholas wrote:

<<Well, if they are truly constants, then the value would never change
and
you should be defining them in code with const.>>

Most things in life are constant in the short term, but variable in
the long term. :-)

<<For something like data input field lengths, I would think that
there is
a better way to do this. I would think that the underlying data store
would
have information on the field length which you can query>>

Yes, that can be done, but presents somewhat of an organizational
challenge for a large database. I don't have a paradigm in place for
that. Might be able to use reflection to somewhat automate it, but
I'll have to give it some thought.

Preferable to have the code AND database pull from the same data
dictionary.

Thanks

Jul 9 '08 #5
On Jul 10, 12:19*am, Greg Esres <ges...@boundvortex.comwrote:
Nicholas wrote:

<<Add a settings file instead. *In that, you can specify the type of
the setting and it will generate the type-safe properties to access
the settings.>>

Interesting...I wasn't familiar with this feature. *Do you feel this
is an appropriate way to define constants, such as data input field
lengths?
If they are not truly constants, but rather tweakable parameters,
then, yes, an application-wide settings file is the way to go.
Just keep in mind that user will sufficient privileges to edit
your .config will then be able to change them on his system...
Jul 10 '08 #6
Pavel wrote;
<<If they are not truly constants, but rather tweakable parameters,
then, >>

Field lengths are probably something that no user should be able to
modify. I'd rather have some way to periodically ensure there was a
match between the database and what the application thought the field
length were. I don't like the idea of the program checking on every
execution, but having to change the source code and recompile is a bit
inflexible. Resource files seem to be a good compromise, but the .Net
environment seems to support only strings.

Thanks
Jul 10 '08 #7

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

Similar topics

1
by: Derick Smith | last post by:
Hi! I am just starting to use .NET and need some help! If I create my own DLL for String resouces using this command: C:\WINNT\MICROS~1.NET\Framework\v1.1.4322\Al /t:lib...
8
by: Lash Rambo | last post by:
How does one go about programming in C++ without making assumptions about the size of types? Is it really possible? For instance, even the well-intentioned, portable C++ (and C) code I've seen...
10
by: emmx | last post by:
Hi I am new to c. I am trying to write a simple program which will prompt the user to enter an integer between 1 and 9 and the output will be produced as follows (eg. 5) 1 22 333 4444 55555
3
by: Jesse | last post by:
Hi together, I've a problem with compiling an application with a build-Script and run it after. Several resource-files I compile with resgen.exe and put the files into a folders of the...
1
by: Stefan Turalski \(stic\) | last post by:
Hi, What I need to do is adding some support for resources files to my application. What I did is: MyAppMain <- startup project MyAppHelper <- project which has MyAppResourcesClass (al a...
4
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
4
by: Roy | last post by:
Hi all, How can I assign null to an integer. This doesn't work Dim intMyValue As Integer intMyVal = System.DBNull.Value Thanks in advance, Roy
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
30
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Let's say we had a simple function for returning the amount of days in a month: unsigned DaysInMonth(unsigned const month) { switch (month) { case 8: case 3: case 5:
20
by: Robbie Hatley | last post by:
I needed a quick program called "random" that gives a random positive integer from n1 to n2. For example, if I type "random 38, 43", I want the program to print a random member of the set {38,...
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: 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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.