What is an IEnumerable?

  • IEnumerable is an interface available in the System.Collection namespace
  • Any collection that implements the IEnumerable implements the GetEnumerator method of the IEnumerable interface, making it iterable.
  • The IEnumerable or the Generic IEnumerable must be used over in-memory objects.

How can you compile a .NET Project without using Visual Studio?

  • We can compile .NET Framework projects without using Visual Studio on the Command Line using csc.exe file.
  • We can supply additional arguments to csc.exe, in-addition to the csproj file of the .NET project.
  • In .NET Core, we use the dotnet build command on the command-line which can build the csproj without using Visual Studio.

What is JIT Compilation?

  • A JIT (Just-In-Time) compiler converts the MSIL (MS Intermediate Language) into native code on demand during the application runtime, when the application components are loaded and executed.
  • The JIT compilation happens specific to the running CPU architecture, since the common language runtime supplies a JIT compiler for each supported CPU architecture.
  • If the managed code calls platform-native APIs or runs platform-specific assemblies, the JITed code runs on only that particular system.

What is a Tuple? How many values can a Tuple Hold?

  • A Tuple is a data structure which can hold data of multiple types in a single variable.
  • Tuple was first introduced in .NET 4.0.
  • A Tuple can generally represent a row in a database table, where each column can represent a different type.
  • Individual values of "Items" inside a single tuple variable can be accessed by means of properties (Item1, Item2, ..)
  • A tuple can hold a maximum of 8 Items in itself, where the individual Items can themselves be Tuples of different items.
var tuple = new Tuple<T1, T2, T3, ... , T7, T8>();

What is GAC in .NET?

  • GAC stands for Global Assembly Cache
  • It is a place in the Windows directory where the assemblies (the DLL files) designated to be shared by the applications are stored for reuse.
  • Any assembly or component which is desired to be shared across applications in a machine is registered on the Global Assembly Cache.
  • To register an assembly into the Global Assembly Cache, we can do so by using the GACUtil.exe as below:
> gacutil -i [Path][Assembly Name].dll

What are Namespaces?

Namespaces are used to group and organize classes which are somewhat related to each other. Any class created would reside under a namespace and is referenced using the namespace in other classes or modules.

namespace MyModule {
  class MyClass {
   // all things under class
  }
  class MyOtherClass {
   // all things under class
  }
}

What is the difference between SingleOrDefault() and FirstOrDefault() methods?

  • Both SingleOrDefault() and FirstOrDefault() LINQ methods return default value of the passed collection data type when there are no matching elements found for the condition predicate.
  • Both methods return only one record from the collection that matches the predicate.
  • SingleOrDefault() expects the condition predicate to match only one record in the set - for example, a postUrl in a collection of BlogPost objects. If there are more than one objects that match the predicate, SingleOrDefault() method throws exception.
  • Whereas the FirstOrDefault() method returns the first object in the collection that matches the prerequisite and so no such exception is thrown.
Privacy Overview
Referbruv

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

3rd Party Cookies

This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.