
If you want to land a C# developer job, this page should be your go-to resource as it has 100 Essential C# interview questions. C# is a popular programming language used to build web applications, games, and more. It has features like automatic garbage collection, interfaces, and strong type-checking, to make the development easy and efficient. Because of its versatility and reliability, C# is widely adopted by both large and small companies to build their products. Preparing for C# interview questions will help you start career, such as Software Developer, Web Developer, Game Developer, Mobile App Developer, and more. Check out these C# Interview Questions with comprehensive answers. We have shortlisted these questions after extensive industry research. Preparing these questions is a sure-shot formula to crack a #C or .NET development interview.
- Compile time, also known as early binding or overloading.
- Runtime, also known as late binding or overriding.
- IEnumerable is in the System.Collections namespace while IQueryable is in the System.Linq namespace
- IEnumerable execute a select query on the server side, load data in-memory on a client-side and then filter data whereas IQueryable implements a ‘select query’ on server-side with all filters.
- IEnumerable is appropriate for querying data from in-memory collections like List, Array. On the other hand, IQueryable is appropriate for querying data from out-memory (like remote database, service) collections
- IEnumerable is helpful for LINQ to Object and LINQ to XML queries unlike IQueryable which is useful for LINQ to SQL queries
- Arithmetic Operators: Used for performing mathematical operations.
- Relational Operators: Used for comparing values and determining relationships.
- Logical/Boolean Operators: Used for logical operations and combining conditions.
- Bitwise Operators: Used for performing operations at the bit level.
- Assignment Operators: Used for assigning values to variables.
- Type Information Operators: Used for obtaining type information at runtime.
- Miscellaneous Operators: Including conditional operators, lambda operators, and more.
- Single-line comments: These comments start with // and are used to document a single line of code.
- Multiline comments: These comments start with /* and end with */. They can span multiple lines and are often used for long explanations or commenting-out sections of code.
- XML comments: These comments start with /// and are used to generate XML documentation for classes, methods, properties, etc. They provide a way to document code elements and generate documentation files.
- Constructor injection: Dependencies are passed to a class through its constructor. This ensures that the class has all the required dependencies when it is instantiated.
- Property injection: Dependencies are set through public properties of a class. This allows for more flexibility, as dependencies can be changed or updated after the class is instantiated.
- Method injection: Dependencies are provided as parameters to specific methods when they are called. This allows for fine-grained control over when and how dependencies are used.
- Delegates are type-safe function pointers that hold references to methods.
- Delegates can be used to create and invoke methods dynamically at runtime.
- Delegates can encapsulate both static and instance methods.
- Delegates have a signature that defines the method parameters and return type they can reference.
- Delegates support multicasting, allowing multiple methods to be invoked through a single delegate.
- Delegates are immutable, meaning that once a delegate is created, it cannot be changed to reference a different method.
- Delegates are commonly used in event handling, callback mechanisms, and implementing the observer pattern.