1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-21 05:51:31 +02:00

Merge pull request #3655 from rmuliterno/patch-1

Adding more translations
This commit is contained in:
Divay Prakash
2019-11-24 12:28:16 +05:30
committed by GitHub

View File

@@ -310,25 +310,26 @@ on a new line! ""Wow!"", the masses cried";
}
///////////////////////////////////////
// Converting Data Types And Typecasting
// Convertendo Data Types e Typecasting
///////////////////////////////////////
// Convertendo dados
// Converter String para Integer
// isso lançará uma exceção "FormatException"
int.Parse("123");//returns an integer version of "123"
// try parse will default to type default on failure
// in this case: 0
// isso vai jogar um erro FormatException quando houver falha
int.Parse("123");//retorna uma verão em Integer da String "123"
// try parse vai ir por padrão para o typo default quando houver uma falha
// nesse caso: 0
int tryInt;
if (int.TryParse("123", out tryInt)) // Function is boolean
if (int.TryParse("123", out tryInt)) // Função booleana
Console.WriteLine(tryInt); // 123
// Convert Integer To String
// Convert class has a number of methods to facilitate conversions
// Converter Integer para String
// A classe Convert possuí métodos para facilitar as conversões
Convert.ToString(123);
// or
// ou
tryInt.ToString();
// Casting