All fields

“Extension Methods” in Information Technology

13 questions across 2 technologies.

Information Technology

13 questions in 2 technologies

#QuestionTechnologyTopicLevel
1Why must extension methods be defined in a static class, and how does the compiler resolve a call to one? C# › Extension MethodsC#Extension MethodsBeginner
2How do you chain multiple extension methods together in a fluent style, and what design principle makes this possible? C# › Extension MethodsC#Extension MethodsIntermediate
3What are extension methods in C#, and how do they let you add functionality to a type you can't modify? C# › Extension MethodsC#Extension MethodsIntermediate
4How would you write extension methods to build a lightweight, fluent validation/guard-clause library? C# › Extension MethodsC#Extension MethodsAdvanced
5Why can't extension methods be used to add STATIC members, operators, or FIELDS to an existing type, and what are the practical implications of this limitation? C# › Extension MethodsC#Extension MethodsAdvanced
6How do 'extension method ambiguity' conflicts arise when two different NuGet packages or namespaces define extension methods with the identical signature, and how do you resolve them? C# › Extension MethodsC#Extension MethodsAdvanced
7How would you write generic extension methods leveraging C# 11's generic math interfaces (like INumber<T>) to build a single reusable numeric utility working across int, double, decimal, and other numeric types? C# › Extension MethodsC#Extension MethodsAdvanced
8What is an extension method, and what syntax makes a static method into one? C# › Extension MethodsC#Extension MethodsBeginner
9How does method resolution priority work when an extension method has the SAME name and signature as an actual instance method on the type? C# › Extension MethodsC#Extension MethodsIntermediate
10How do you write a generic extension method that works with any collection type, like a custom 'IsEmpty()' check? C# › Extension MethodsC#Extension MethodsIntermediate
11How would you write an extension method on an interface (like IEnumerable<T>) that provides a default implementation shared across EVERY concrete implementing type? C# › Extension MethodsC#Extension MethodsAdvanced
12What are extension methods in Dart, and how do they let you add new useful functionality directly onto an existing class, including classes you did not originally write yourself, such as Dart's own built in String class? Flutter › Dart Language Basics & SyntaxFlutterDart Language Basics & SyntaxIntermediate
13How would you write an extension method to safely add or remove a specific flag from a [Flags] enum value without manual bitwise operators scattered throughout your code? C# › Enums & FlagsC#Enums & FlagsAdvanced