Logo 
Search:

Interview FAQs

Submit Interview FAQ
Home » Interview FAQsRSS Feeds
C#
Comments: 0

Can I use typedefs in C#?

No, C# has no direct equivalent of the C++ typedef. C# does allow an alias to be specified via the using keyword:

using IntList = System.Collections.Generic.List;
but the alias only applies in the file in which it is declared. A workaround in...
Posted By:Evelyn Hughes      Posted On: Dec 15

C#
Comments: 0

Structs are largely redundant in C++. Why does C# have them?

In C++, a struct and a class are pretty much the same thing. The only difference is the default visibility level (public for structs, private for classes). However, in C# structs and classes are very different. In C#, structs are value types (instanc...
Posted By:Douglas Sullivan      Posted On: Sep 16

C#
Comments: 0

What are the fundamental differences between value types and reference types?

C# divides types into two categories - value types and reference types. Most of the intrinsic types (e.g. int, char) are value types. Structs are also value types. Reference types include classes, arrays and strings. The basic idea is straightforward...
Posted By:Willard Washington      Posted On: Mar 12

C#
Comments: 0

Is it true that all C# types derive from a common base class?

Yes and no. All types can be treated as if they derive from object (System.Object), but in order to treat an instance of a value type (e.g. int, float) as object-derived, the instance must be converted to a reference type using a process called 'boxi...
Posted By:Jeffrey Washington      Posted On: Nov 04

C#
Comments: 0

So I can pass an instance of a value type to a method that takes an object as a parameter?

Yes. For example:

class CApplication
{
public static void Main()
{
int x = 25;
string s = "fred";

DisplayMe( x );
DisplayMe( s );
}

...
Posted By:Landra Schmidt      Posted On: Oct 16

C#
Comments: 0

Does C# have its own class library?

Not exactly. The .NET Framework has a comprehensive class library, which C# can make use of. C# does not have its own class library.
Posted By:Jean Bell      Posted On: Feb 09

  43  44  45  46  47  48  49  50  51  52  53