How do I create a multi language, multi file assembly?
Unfortunately, this is currently not supported in the IDE. To do this
from the command line, you must compile your projects into netmodules (/target:module
on the C# compiler), and then use the command line tool al.exe (alink)
to link these netmodules together.
C# provides a default constructor for me. I write a constructor that
takes a string as a parameter, but want to keep the no parameter one.
How many constructors should I write?
Two. Once you write at least one constructor, C# cancels the freebie
constructor, and now you have to write one yourself, even if there is no
implementation in
What is the equivalent to regsvr32 and regsvr32 /u a file in .NET
development?
Try using RegAsm.exe. The general syntax would be: RegAsm. A good
description of RegAsm and its associated switches is located in the .NET
SDK docs. Just search on "Assembly Registration Tool".Explain ACID rule
of thumb for transactions.
Transaction must be Atomic (it is one unit of work and does not
dependent on previous and following transactions), Consistent (data is
either committed or roll back, no in-between case where something has
been updated and something hasnot), Isolated (no transaction sees the
intermediate results of the current transaction), Durable (the values
persist if the data had been committed even if the system crashes right
after).
Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the
constructor.
How do I create a multilanguage, single-file assembly?
This is currently not supported by Visual Studio .NET.
Why cannot you specify the accessibility modifier for methods inside
the interface?
They all must be public. Therefore, to prevent you from getting the
false impression that you have any freedom of choice, you are not
allowed to specify any accessibility, it is public by default.
Is it possible to restrict the scope of a field/method of a class to
the classes in the same namespace?
There is no way to restrict to a namespace. Namespaces are never units
of protection. But if you're using assemblies, you can use the
'internal' access modifier to restrict access to only within the
assembly.
Why do I get a syntax error when trying to declare a
variable called checked?
The word checked is a keyword in C#.
Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose and for some applications that
are constantly running you run the risk of overloading the machine and
the hard drive there. Five levels range from None to Verbose, allowing
to fine-tune the tracing activities.
What is the syntax for calling an overloaded constructor within a
constructor (this() and constructorname() does not compile)?
The syntax for calling another constructor is as follows:
class B
{
B(int i)
{ }
}
class C : B
{
C() : base(5) // call base constructor B(5)
{ }
C(int i) : this() // call C()
{ }
public static void Main() {}
}
Why do I get a "CS5001: does not have an entry point defined"
error when compiling?
The most common problem is that you used a lowercase 'm' when defining
the Main method. The correct way to implement the entry point is as
follows:
class test
{
static void Main(string[] args) {}
}
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
What optimizations does the C# compiler perform when you use the
/optimize+ compiler option?
The following is a response from a developer on the C# compiler team:
We get rid of unused locals (i.e., locals that are never read, even if
assigned).
We get rid of unreachable code.
We get rid of try-catch w/ an empty try.
We get rid of try-finally w/ an empty try (convert to normal code...).
We get rid of try-finally w/ an empty finally (convert to normal
code...).
We optimize branches over branches:
gotoif A, lab1
goto lab2:
lab1:
turns into: gotoif !A, lab2
lab1:
We optimize branches to ret, branches to next instruction, and branches
to branches.
Page Numbers :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16