December 2004 - Posts

What does the /target: command line option do in the C# compiler?
04 December 04 11:33 PM
All the /target: options except module create .NET assemblies. Depending on the option, the compiler adds metadata for the operating system to use when loading the portable executable (PE) file and for the runtime to use in executing the contained assembly Read More...
Postedby CSharpFAQ | 5 Comments    
What is the difference between const and static readonly?
03 December 04 05:13 PM
The difference is that the value of a static readonly field is set at run time, and can thus be modified by the containing class, w hereas the value of a const field is set to a compile time constant. In the static readonly case, the containing class Read More...
Postedby CSharpFAQ | 8 Comments    
How do I create a constant that is an array?
03 December 04 09:33 AM
Strictly speaking you can't, since const can only be applied to a field or local whose value is known at compile time. In both the lines below, the right-hand is not a constant expression (not in C#). const int [] constIntArray = newint [] {2, 3, 4}; Read More...
Postedby CSharpFAQ | 6 Comments    
How do I get and set Environment variables?
02 December 04 09:01 AM
Use the System.Environment class. Specifically the GetEnvironmentVariable and SetEnvironmentVariable methods. Admitedly, this is not a question specific to C#, but it is one I have seen enough C# programmers ask, and the ability to set environment variables Read More...
Postedby CSharpFAQ | 5 Comments    
Filed under: , ,

This Blog

Syndication

Page view tracker