Converting data into types such as int and double

2

I'm having trouble converting data from a database, for example I'm running a query like this:

carteira ca = bc.carteira.FirstOrDefault(obj => obj.cpf == cepf && obj.codigo == cod);

I get data information of type ca.valor , ca.inicio , ... I would like to know how to convert this value to a type like int, double, ... In order to make the following additions:

int result;
double soma;
int x = ca.valor + result;  
double y = ca.inicio + soma;

And so I can use them in a method of my project

chama.meuMetodo(x,y); // x e y seriam int e double

I confess that I forgot how to do this conversion and your Google is not helping.

    
asked by anonymous 02.06.2014 / 23:32

1 answer

1

Experience this

Java

Double.parseDouble(x)
Integer.parseInt(x)

C #

Convert.ToDouble(x) 
Convert.ToInt32(x)
    
02.06.2014 / 23:39