value-type
Why is boxing a primitive value-type in .NET uncached, unlike Java?
Consider: int a = 42; // Reference equality on two boxed ints with the same value Console.WriteLine( (object)a == (object)a ); // False[详细]
2023-01-26 06:45 分类:问答Selection bug for listbox where the list items are value types / structs and contain duplicates?
I turned an Horizontal ItemsControl to a Listbox so that I am able to select individual items but found that the selection was broken. Took some time to distill out the problematic bit.[详细]
2023-01-24 19:20 分类:问答VB.NET Pointer to value types
VB.NET 2010, .NET 4 Hello all, I\'m by no means a good programmer and I\'m just trying to wrap my head around some of this stuff, so please forgive me if this is a dumb question.[详细]
2023-01-24 11:28 分类:问答Why doesn't delegate contravariance work with value types?
This snippet is not compiled in LINQPad. void Main() { (new[]{0,1,2,3}).Where(IsNull).Dump(); } static bool IsNull(object arg) { return arg == null; }[详细]
2023-01-23 17:34 分类:问答Would there be benefits to a struct String in .Net?
Note: This is a hypothetical discussion. I don\'t actually want to implement a struct String. The .Net String class could be a value type (a struct), because it is immutable and has few members. But[详细]
2023-01-23 07:05 分类:问答Set an enum to its default value
I\'m sure this is fairly trivial but I can\'t get it right. public static string DoSomething(this Enum value)[详细]
2023-01-23 06:21 分类:问答how can i remove the value from a DateTime?
i have an existing DateTime? object that has a datetime in i开发者_开发技巧t.I want to remove the datetime value from it so when you ask \"HasValue\" it returns false?Nullable<T>is immutable, so[详细]
2023-01-21 09:40 分类:问答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 value type and reference type parameters, i.e. int is value, and string is reference.[详细]
2023-01-21 05:58 分类:问答Where are ref value type parameters stored for asynchronous method calls in Microsoft's CLR?
I understand that this is an implementation detail. I\'m actually curious what that implementation detail is in Microsoft\'s CLR.[详细]
2023-01-19 17:01 分类:问答Is this some kind of referencing problem? Value not sticking
Apologies for the appalling title. I have mocked up this code to mimic an issue I was encountering on a project.[详细]
2023-01-18 07:28 分类:问答