tagged [reference-type]
Is creating a C# generic method that accepts (nullable) value type and reference type possible?
Is creating a C# generic method that accepts (nullable) value type and reference type possible? I want to create a simple method that accepts both and parameters, i.e. int is value, and string is refe...
- Modified
- 22 Apr at 03:12
Generic constraint on T to be reference type and value type simultaneously?
Generic constraint on T to be reference type and value type simultaneously? I have a problem with understanding how generic constraints work. I think I am missing something important here. I have encl...
- Modified
- 15 Oct at 11:58
Is object a reference type or value type?
Is object a reference type or value type? I have still doubts about `object`. It is the primary base class of anything, any class. But is it reference type or value type. Or like which of these acts i...
- Modified
- 28 Jul at 09:14
c# readonly object
c# readonly object Is there any way to return a readonly instance of an object? ``` public class Person { public String FirstName { get; set; } public String LastName { get; set; } } public class ...
- Modified
- 23 Aug at 17:42
Dictionary.ContainsKey() - How does it work?
Dictionary.ContainsKey() - How does it work? I've read the MSDN documentation on how `Dictionary.ContainsKey()` works, but I was wondering how it actually makes the equality comparison? Basically, I h...
- Modified
- 7 Nov at 02:23
C# pass by value vs. pass by reference
C# pass by value vs. pass by reference Consider the following code It is universally acknowledged (in C# at least) that when you pass by reference, the method contains a reference to the object being ...
- Modified
- 12 Oct at 13:58
Reflexive type parameter constraints: X<T> where T : X<T> ‒ any simpler alternatives?
Reflexive type parameter constraints: X where T : X ‒ any simpler alternatives? Every so often I am making a simple interface more complicated by adding a self-referencing ("reflexive") type parameter...
- Modified
- 15 Jan at 10:6
Why reference types inside structs behave like value types?
Why reference types inside structs behave like value types? I am a beginner to C# programming. I am now studying `strings`, `structs`, `value types` and `reference types`. As accepted answers in [here...
- Modified
- 23 May at 11:54
Are event arguments passed by reference or value in C#?
Are event arguments passed by reference or value in C#? A rather simple question (I think), but I don't seem to see an answer already. I know that some values are passed via value (like int and long),...
- Modified
- 3 Aug at 17:37
.NET Parameter passing - by reference v/s by value
.NET Parameter passing - by reference v/s by value I'm trying to validate my understanding of how C#/.NET/CLR treats value types and reference types. I've read so many contradicting explanations I sti...
- Modified
- 27 Feb at 03:47
Dilemma with using value types with `new` operator in C#
Dilemma with using value types with `new` operator in C# When `operator new()` is used with reference type, space for the instance is allocated on the heap and reference variable itself is placed on t...
- Modified
- 6 Apr at 08:53
Why are delegates reference types?
Why are delegates reference types? : I disagree with a small part of [Jeffrey's answer](https://stackoverflow.com/questions/7905962/why-are-delegates-reference-types/7906297#7906297), namely the point...
- Modified
- 23 May at 12:0