¡@

Home 

c# Programming Glossary: unbox

Why can't I unbox an int as a decimal?

http://stackoverflow.com/questions/1085097/why-cant-i-unbox-an-int-as-a-decimal

can't I unbox an int as a decimal I have an IDataRecord reader that I'm retrieving.. left me scratching my head wondering why it is failing to unbox the int contained in the reader as a decimal. Does anyone know.. Is there something subtle I'm missing c# decimal int unboxing share improve this question You can only unbox a value..

C# ?: Conditional Operator

http://stackoverflow.com/questions/1171717/c-sharp-conditional-operator

0 Therefore the zero returned is a boxed int. You then unbox the int to decimal. It is illegal to unbox a boxed int to decimal... int. You then unbox the int to decimal. It is illegal to unbox a boxed int to decimal. For the reasons why see my blog article..

Value Type Vs Reference Type - Object Class C#

http://stackoverflow.com/questions/1205444/value-type-vs-reference-type-object-class-c-sharp

value . The boxed version is a reference type. You can unbox this by casting back to the struct version which reverses this..

Do generic interfaces in C# prevent boxing? (.NET vs Mono performance)

http://stackoverflow.com/questions/139979/do-generic-interfaces-in-c-sharp-prevent-boxing-net-vs-mono-performance

the conversion of byte to and from object is boxing and unboxing which are computationally expensive operations affecting.. solving this problem with a generic interface avoid boxing unboxing public interface IMyInterface T void MyMethod T arg public.. of the specific type is generated there is no need to box unbox the type. This is why the Collections.Generic library was a..

Is casting the same thing as converting?

http://stackoverflow.com/questions/143997/is-casting-the-same-thing-as-converting

converted assignment. In the former you can see the boxing unboxing occurring in the latter you can see a call to a convert method... f 1.5f int i int f Conversion When the casting expression unboxes the result assuming it works is usually just a copy of what.. with the same type. There are exceptions however you can unbox from a boxed int to an enum with an underlying type of int and..

Enumerable.Cast<T> extension method fails to cast from int to long, why? [duplicate]

http://stackoverflow.com/questions/1684448/enumerable-castt-extension-method-fails-to-cast-from-int-to-long-why

it's an object. Not an int. This fails because we can only unbox from an object to the exact type we want. We are going from.. Eric Lippert discussed this on his blog we ™ve decided that unboxing can only unbox to the exact type. If you want to call the.. this on his blog we ™ve decided that unboxing can only unbox to the exact type. If you want to call the slow method that..

Why do we need boxing and unboxing in C#?

http://stackoverflow.com/questions/2111857/why-do-we-need-boxing-and-unboxing-in-c

do we need boxing and unboxing in C# Why do we need boxing and unboxing in C# I know what.. need boxing and unboxing in C# Why do we need boxing and unboxing in C# I know what boxing and unboxing is but I can't comprehend.. we need boxing and unboxing in C# I know what boxing and unboxing is but I can't comprehend the real use of it. Why and where..

Cast object to decimal? (nullable decimal)

http://stackoverflow.com/questions/527453/cast-object-to-decimal-nullable-decimal

Unboxing only works if the type is identical You can't unbox an object that does not contain the target value. What you need..

What is the difference between the following casts in c#?

http://stackoverflow.com/questions/702234/what-is-the-difference-between-the-following-casts-in-c

you can't do o as int . The cast operator is also used for unboxing. as can be used to unbox to a nullable value type. The cast.. cast operator is also used for unboxing. as can be used to unbox to a nullable value type. The cast operator can also perform..

What is it that makes Enum.HasFlag so slow?

http://stackoverflow.com/questions/7368652/what-is-it-that-makes-enum-hasflag-so-slow

in this check. Secondly there is an unfortunate box and unbox of the value during a conversion to UInt64 that occurs inside..