One solution is to create a class with all static const variables (it
that
even allowed?).
This is pretty much exactly what const fields are for. E.g.
class Foo
{
public const int THIS_VAL = 10;
public const int MAX_THAT = 255;
static void Main()
{
Console.WriteLine(MAX_THAT
No preprocessor in C#. So your out of luck for traditional defines. I
usually make an internal static class with the consts...
Thanks,
Shawn Wildermuth
[EMAIL PROTECTED]
-Original Message-
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of
Some time ago, Sills, Adam wrote...
Are both instances of VS.NET using the same developer profile?
Yes, Visual C++ 6.0 developer.
-kkm
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at
I don't know the details of your design, but perhaps you can use ordinary
(non-singleton) objects that simply maintain their state in a shared, machine-wide
medium (eg: a file with a well-known pathname).
Of course you'd need to synchronize access to the file... but depending on your usage
There is an equivalent, use const. (Note that a const can not be static)
According to the C# lang spec at [1]:
Whenever an expression is of one of the types listed above and contains
only the constructs listed above, the expression is evaluated at compile-
time. This is true even if the
Noam,
Sorry for the unfinished example... Just for completeness (I still have to
get used to this web interface. The tab key does not quite act as I would
want it to...):
public class MyConstants
{
public const int TweeEnVeertig = 42;
public const string HalloWereld = HelloWorld;
}
class
PLEASE - you benchmark two different things :-)
C#:
ArrayList ElementObject= new ArrayList();
C++:
VECTORINT intList;
intList.reserve(500L);
I strongly suggest you do reserve the space in the ArrayList, too.
Currently ArrayList (in the C# code) gets expanded multiple
We have built a small windows service using SQL Server WMI Provider,
Every time a connection is established a WMI async event is triggered by
SQL Server WMI Provider and this trigger is handled by a custom
component. We do some custom business logic check and if the user is not
a legitimate user
However I would still expect considerably worse performance from the CLR
solution because it will be boxing everything that goes in there.
So for this benchmark, what are you trying to measure? Do you only care
about the performance of a container of ints, or are you trying to infer
something
Hi,
We have a web application where users will be adding compiled
user controls into the site. (Ascx + *.dll)
I need to be able to catch and handle compiler errors in the main web
project.
When I drill down, way down, in the exception object I can see the
error message that is shown if there
Following suggestions in Chris Sell's article about accessing properties
of a form using multiple threads, I decided to implement this in my
program. I first made up a quick test program to make sure I understood
everthing that was happening. After successfully implementing the test
program
Is it possible to read the file from the cache, once it is read ...till the
browser is refreshed?
I you want to read cached XML, keep in mind that an instance of XmlTextReader
can be constructed from any stream, including a MemoryStream. Is that what
you're wanting to do?
12 matches
Mail list logo