tagged [base-class]
How to make a ReadOnlyCollection from a HashSet without copying the elements?
How to make a ReadOnlyCollection from a HashSet without copying the elements? I have a private `HashSet` which is the backing field of a read-only property which should return a read-only collection s...
- Modified
- 28 Apr at 18:51
.NET: Unable to cast object to interface it implements
.NET: Unable to cast object to interface it implements I have a class (TabControlH60) that both inherits from a base class (UserControl) and implements an interface (IFrameworkClient). I instantiate t...
- Modified
- 20 Oct at 19:32
How Microsoft.Bcl.Async works?
How Microsoft.Bcl.Async works? `Microsoft.Bcl.Async` enables developers to use `async/await` keywords without .NET Framework 4.5 that they are supposed to target to use them. That's great, thanks to t...
- Modified
- 25 Jan at 16:42
What does RuntimeHelpers.GetHashCode do
What does RuntimeHelpers.GetHashCode do The `RuntimeHelpers.GetHashCode(object)` method allows generating hash codes based on the identity of an object. MSDN [states](http://msdn.microsoft.com/en-us/l...
- Modified
- 28 Jun at 07:40
What is the purpose of the methods in System.Reflection.RuntimeReflectionExtensions?
What is the purpose of the methods in System.Reflection.RuntimeReflectionExtensions? Since .NET 4.5 (2012), some new extension methods show up, from [System.Reflection.RuntimeReflectionExtensions clas...
- Modified
- 19 Mar at 11:5
Abstract Base Class vs. Concrete Class as a SuperType
Abstract Base Class vs. Concrete Class as a SuperType After reading the most excellent book "Head First Design Patterns", I began proselytizing to my colleagues the benefits of patterns and design pri...
- Modified
- 9 Jun at 19:40
What changed in System.ValueTuple 4.4.0 -> 4.5.0?
What changed in System.ValueTuple 4.4.0 -> 4.5.0? I consider updating my `System.ValueTuple` references from 4.4.0 to (current) 4.5.0. To avoid regressions, I'd like to find out what changed between t...
- Modified
- 4 Sep at 13:8
Why do BCL Collections use struct enumerators, not classes?
Why do BCL Collections use struct enumerators, not classes? We all know [mutable structs are evil](https://ericlippert.com/2008/05/14/mutating-readonly-structs/) in general. I'm also pretty sure that ...
- Modified
- 14 Jan at 03:44
More trivia than really important: Why no new() constraint on Activator.CreateInstance<T>()?
More trivia than really important: Why no new() constraint on Activator.CreateInstance()? I think there are people who may be able to answer this, this is a question out of curiosity: The generic `Cre...
- Modified
- 3 Mar at 23:38
Does delete on a pointer to a subclass call the base class destructor?
Does delete on a pointer to a subclass call the base class destructor? I have an `class A` which uses a heap memory allocation for one of its fields. Class A is instantiated and stored as a pointer fi...
- Modified
- 20 Jun at 09:12
C# private (hidden) base class
C# private (hidden) base class Is it possible to make a C# base class accessible only within the library assembly it's compiled into, while making other subclasses that inherit from it public? For exa...
- Modified
- 4 Sep at 15:34
Mathematical explanation why Decimal's conversion to Double is broken and Decimal.GetHashCode separates equal instances
Mathematical explanation why Decimal's conversion to Double is broken and Decimal.GetHashCode separates equal instances I am not sure if this non-standard way of stating a Stack Overflow question is g...
- Modified
- 7 Jun at 09:31
Why is a "bindingRedirect" added to the app.config file after adding the Microsoft.Bcl.Async package?
Why is a "bindingRedirect" added to the app.config file after adding the Microsoft.Bcl.Async package? I was wondering why nuget added the following code to my applications `app.config` file, after ins...
- Modified
- 4 Jun at 20:33
How to avoid error "Constructor on type 'MyType' not found" when inheriting a base class
How to avoid error "Constructor on type 'MyType' not found" when inheriting a base class I have a Visual Studio 2010 Windows Forms app which includes a Form base class that other classes will inherit....
- Modified
- 1 May at 20:32
How do I call a derived class method from the base class?
How do I call a derived class method from the base class? I have read several similar questions about this but none seem to solve the problem I am facing. The typical answer is to cast as the derived ...
- Modified
- 18 Apr at 16:49
In .NET, can you use reflection to get all non-inherited methods of a class?
In .NET, can you use reflection to get all non-inherited methods of a class? Because of this issue [here](https://stackoverflow.com/q/5863496/168179), I'm trying to write a custom JsonConverter that h...
- Modified
- 23 May at 12:9
Is there any kind of "ReferenceComparer" in .NET?
Is there any kind of "ReferenceComparer" in .NET? There are several places in BCL where one can make use of [IEqualityComparer](http://msdn.microsoft.com/en-us/library/ms132151.aspx). Like [Enumerable...
- Modified
- 4 Feb at 18:1
How to call an explicitly implemented interface-method on the base class
How to call an explicitly implemented interface-method on the base class I have a situation, where two classes (one deriving from the other) both implement the same interface explicitly: From the deri...
- Modified
- 16 May at 14:40
Can you extend the default JsonConverter used in JSON.NET for collections?
Can you extend the default JsonConverter used in JSON.NET for collections? I'm trying to write a custom JsonConverter for cases where a person subclasses a list or collection, but then adds extra prop...
- Modified
- 30 Mar at 07:10
ServiceStack Services and the default GET/POST/DELETE methods
ServiceStack Services and the default GET/POST/DELETE methods I've created a couple services with ServiceStack and I wanted to inherit a base class. the problem is that this base class has a couple me...
- Modified
- 27 Oct at 17:39
Meaning of confusing comment above "string.Empty" in .NET/BCL source?
Meaning of confusing comment above "string.Empty" in .NET/BCL source? I'm trying to understand why `string.Empty` is `readonly` and not a `const`. I saw [this](https://stackoverflow.com/q/507923/60117...
- Modified
- 23 May at 11:45
C# "Rename" Property in Derived Class
C# "Rename" Property in Derived Class When you read this you'll be awfully tempted to give advice like "this is a bad idea for the following reason..." Bear with me. I know there are other ways to app...
- Modified
- 7 Sep at 21:28
Reflection with generic syntax fails on a return parameter of an overridden method
Reflection with generic syntax fails on a return parameter of an overridden method To avoid old-fashioned non-generic syntax when searching for attributes of a known type, one usually uses the extensi...
- Modified
- 1 Aug at 13:54
Using Microsoft.Bcl.Async with Code Analysis causes errors
Using Microsoft.Bcl.Async with Code Analysis causes errors I'm trying to use [Microsoft.Bcl.Async](https://nuget.org/packages/Microsoft.Bcl.Async) and Code Analysis, but when I run Code Analysis I get...
- Modified
- 20 Jun at 09:12
Why is the Linq-to-Objects sum of a sequence of nullables itself nullable?
Why is the Linq-to-Objects sum of a sequence of nullables itself nullable? As usual, `int?` means `System.Nullable` (or `System.Nullable`1[System.Int32]`). Suppose you have an in-memory `IEnumerable` ...
- Modified
- 8 Dec at 13:32