Top "Casting" questions

Casting is a process where an object type is explicitly converted into another type if the conversion is allowed.

Difference between is and as keyword

Please tell what is the difference between is and as keyword in C#

c# casting
Idiomatic way to do conversion/type assertion on multiple return values in Go

What is the idiomatic way to cast multiple return values in Go? Can you do it in a single line, …

casting go return-value
TypeScript: Convert a bool to string value

I have a really simple issue, I can't get to convert a simple boolean to a string value in TypeScript. …

casting type-conversion typescript
Casting vs Converting an object toString, when object really is a string

This isn't really an issue, however I am curious. When I save a string in lets say an DataRow, it …

c# string casting parsing
InvalidCastException: Unable To Cast Objects of type [base] to type [subclass]

I have a custom CustomMembershipUser that inherits from MembershipUser. public class ConfigMembershipUser : MembershipUser { // custom stuff } I am using Linq-to-SQL to …

c# casting membershipuser
Casting CGFloat to Float in Swift

I need to store a value as a Float, but the source data is a CGFloat: let myFloat : Float = myRect.…

casting swift cgfloat
unsigned char to int in C++

I have a variable unsigned char that contains a value, 40 for example. I want a int variable to get that …

c++ casting unsigned
Comparator with double type

I have written the following code: public class NewClass2 implements Comparator<Point> { public int compare(Point p1, Point …

java casting double comparator
Assignment in an if statement

I have a class Animal, and its subclass Dog. I often find myself coding the following lines: if (animal is …

c# casting if-statement
Explicit type casting example in Java

I have come across this example on http://www.javabeginner.com/learn-java/java-object-typecasting and in the part where it talks …

java casting downcast