Top "Casting" questions

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

Int to Char in C#

What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int …

c# casting
How do you cast a List of supertypes to a List of subtypes?

For example, lets say you have two classes: public class TestA {} public class TestB extends TestA{} I have a method …

java list generics collections casting
C++ convert from 1 char to string?

I need to cast only 1 char to string. The opposite way is pretty simple like str[0]. The following did not …

c++ casting
How do I convert Int/Decimal to float in C#?

How does one convert from an int or a decimal to a float in C#? I need to use a …

c# casting floating-point
TypeScript or JavaScript type casting

How does one handle type casting in TypeScript or Javascript? Say I have the following TypeScript code: module Symbology { export …

casting typescript
Do I cast the result of malloc?

In this question, someone suggested in a comment that I should not cast the result of malloc, i.e. int *…

c malloc casting
Android, How can I Convert String to Date?

I store current time in database each time application starts by user. Calendar c = Calendar.getInstance(); String str = c.getTime().…

android string date casting
How to avoid warning when introducing NAs by coercion

I generally prefer to code R so that I don't get warnings, but I don't know how to avoid getting …

r parsing casting na
explicit casting from super class to subclass

public class Animal { public void eat() {} } public class Dog extends Animal { public void eat() {} public void main(String[] args) { Animal …

java casting classcastexception
Convert base class to derived class

Is it possible in C# to explicitly convert a base class object to one of it's derived classes? Currently thinking …

c# inheritance casting downcast