¡@

Home 

c# Programming Glossary: casts

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

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

there are plenty of IL instructions for different types of casts between primitive types Calling user defined conversion operators..

Why C# doesn't allow inheritance of return type when implementing an Interface

http://stackoverflow.com/questions/1319663/why-c-sharp-doesnt-allow-inheritance-of-return-type-when-implementing-an-interf

just spit a whole bunch of little helper methods that do casts on the return type to the right thing. There's nothing stopping..

Are doubles faster than floats in c#?

http://stackoverflow.com/questions/158889/are-doubles-faster-than-floats-in-c

important as you can slow yourself down with unnecessary casts to from float and double which result in JIT'd code which requests..

Should I use uint in C# for values that can't be negative?

http://stackoverflow.com/questions/2013116/should-i-use-uint-in-c-sharp-for-values-that-cant-be-negative

out an integral type returns an int therefore requiring casts in several points. I wanted to construct a StringBuffer with..

Compiler Ambiguous invocation error - anonymous method and method group with Func<> or Action

http://stackoverflow.com/questions/2057146/compiler-ambiguous-invocation-error-anonymous-method-and-method-group-with-fun

should be necessary. Can anyone explain why the explicit casts should be required. Code sample below. class Program static..

Casting: (NewType) vs. Object as NewType [duplicate]

http://stackoverflow.com/questions/2483/casting-newtype-vs-object-as-newtype

the CLR What is actually the difference between these two casts SomeClass sc SomeClass SomeObject SomeClass sc2 SomeObject as.. as SomeClass Normally they should both be explicit casts to the specified type c# .net share improve this question..

Using a bitmask in C#

http://stackoverflow.com/questions/3261451/using-a-bitmask-in-c-sharp

I make life easier on myself with a FlagsHelper class The casts to object in the below code are an unfortunate necessity due..

string = string + int: What's behind the scene? (C#)

http://stackoverflow.com/questions/3398604/string-string-int-whats-behind-the-scene-c

convert source type 'int' to target type 'string' How C# casts 0 as string. Is it 0.ToString or string 0 or something else..

C# vs Java generics [duplicate]

http://stackoverflow.com/questions/355060/c-sharp-vs-java-generics

are not actually generic. They compile down to Object and casts. In effect Java generics are a compile time artifact and can..

Why are C# 3.0 object initializer constructor parentheses optional?

http://stackoverflow.com/questions/3661025/why-are-c-sharp-3-0-object-initializer-constructor-parentheses-optional

which of the two cases you probably meant. Similarly casts are ambiguous even in C# 1.0 G T x Is that cast x to T or subtract..

C# Dynamic Keyword ??Run-time penalty?

http://stackoverflow.com/questions/3784317/c-sharp-dynamic-keyword-run-time-penalty

or are you thinking of runtime type checks caused by casts or what Perhaps it would be best to simply explain what dynamic..

How do I cast a List<T> effectively?

http://stackoverflow.com/questions/504729/how-do-i-cast-a-listt-effectively

T and skips the ones that are not of that type. list.Cast casts all items in the original list to type T and throws an exception..

C# 'is' operator performance

http://stackoverflow.com/questions/686412/c-sharp-is-operator-performance

once you check the type you cast to that type. is actually casts the object to the type you are checking so any subsequent casting..

The cast to value type 'Int32' failed because the materialized value is null

http://stackoverflow.com/questions/6864311/the-cast-to-value-type-int32-failed-because-the-materialized-value-is-null

where u.ID userID select int ch.Amount .Sum 0 This first casts to int to tell the C# compiler that this expression can indeed..

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

is the difference between the following casts in c# If there is a difference what is the difference between..

What is your favorite use of Resharper? [closed]

http://stackoverflow.com/questions/76499/what-is-your-favorite-use-of-resharper

to eliminate redundant Using statements ToString calls and casts. I guess in theory this should reduce the expense of my code..

Boxing Occurrence in C#

http://stackoverflow.com/questions/7995606/boxing-occurrence-in-c-sharp

object or an interface type because this automatically casts the value type to the object interface. By the way the string..

byte + byte = int… why?

http://stackoverflow.com/questions/941584/byte-byte-int-why

is faster because of cache hits . But the extensive byte casts spread through the code make it that much more unreadable. ..