Always when I convert an object to a specific type, I use an explicit cast , for example:
private void textBox1_Leave(object sender, EventArgs e)
{
TextBox textBoxTemp = (TextBox)sender;
MessageBox.Show("Você digitou: " + textBoxTemp....
What's the difference between them? When is it best to use one or the other?
Examples:
string palavra = "10";
var numero = Convert.ToInt32(palavra); // ou (int)palavra ?
string palavra2 = "10.50";
var numero2 = (double)palavra2; // ou Conv...
I have a ESTOQUE table containing a field called QTDE , this field has 3 decimal places.
What would be the command to return straight from SQL formatted with 3 houses? Because the whole values are returning without the houses....
I have an enum (enumeration) calling Notas and I need to get the integer corresponding to one of its constants.
public enum Nota
{
Otimo = 5,
MuitoBom = 4,
Bom = 3,
Regular = 2,
Ruim = 1,
Insuficiente = 0
}
I...
I wonder if there is a difference between:
String a = (String) arg;
and cast class:
String a = String.class.cast(arg);
I once heard that using the static cast class is more performative, is this true?
I have this scenario:
- do a multiplication of 2 values that will be rounded to 2 boxes for the table that will be inserted its result.
Follow the example:
CREATE TABLE #TMP (
A DECIMAL(23,6),
B DECIMAL(28,2)
)
INSERT INTO #TMP VAL...
A question about casting in C #, I see in many sources using cast in the following ways.
What's the difference between one and the other when using one way or another?
public interface InterfaceTeste
{
int Id { get; set; }
}
public...