Casting VS Converting VS Parsing in C#: Which to choose?

  Рет қаралды 10,459

tutorialsEU

tutorialsEU

Күн бұрын

Пікірлер: 17
@HawkEncounters
@HawkEncounters 3 жыл бұрын
Glad that you keep us updated on KZbin too. Keep up the GoodWork. :)
@tutorialsEU
@tutorialsEU 3 жыл бұрын
Thank you for watching : ).
@firstlast493
@firstlast493 Жыл бұрын
2:24 2 years ago Visual Studio had code suggestions without those Copilots. But that's gone now.
@GalaxyCookies76
@GalaxyCookies76 Жыл бұрын
Hey, I noticed you didn't include details of Casting VS Converting VS Parsing in your UDEMY master class course. I think it's an important video, so pls add it to the course
@mertkurt947
@mertkurt947 2 жыл бұрын
very helpful and also i liked try and catch :) many thanks
@abugsbunny
@abugsbunny 2 жыл бұрын
Great. Many thanks
@vinhnghiang1273
@vinhnghiang1273 2 жыл бұрын
thank you alot!
@soroushjm1011
@soroushjm1011 2 жыл бұрын
Nice Just boosting algorithm
@guillermomazzari4983
@guillermomazzari4983 Жыл бұрын
Thanks for sharing! I have a list of strings, I need to convert some of those values to Decimals, I have a class called "Promedio" with some values that are type decimal. I'm writing th following code: List values (this is the list with all the string values, they come from several inputs form the user) then im using my class "Promedio" to create a new object and trying to set the values of the List to the fields of my class, like this: Promedios promedio = new() { C1 = Convert.ToDecimal(values[0]), C2 = Convert.ToDecimal(values[1]), Leaf = Convert.ToDecimal(values[2]), Stpl = Convert.ToDecimal(values[3]), Mic = Convert.ToDecimal(values[4]) } but instead of returning decimal values, it returns items like this: values[0] = "1.2367" and C1 ends up being: 12376 I tried several solutions but I dont know what else to do, please help
@SoulReaper7x
@SoulReaper7x Жыл бұрын
That's strange, I tried it out for myself and didn't have any problems with it. Sorry if I'm wrong but I'm assuming promedio means Average? If so, here's what I did: static void Average() { List values = new List() {"43.47", "75.23", "95.94", "13.26", "94.06"}; float C1 = Convert.ToSingle(values[0]), C2 = Convert.ToSingle(values[1]), Leaf = Convert.ToSingle(values[2]), Stpl = Convert.ToSingle(values[3]), Mic = Convert.ToSingle(values[4]); Console.WriteLine((C1 + C2 + Leaf + Stpl + Mic) / 5); } After testing out this method, it returns me the result of 64.392006. So I wonder why it's not reading the decimal for you at all??
@TrippleXD545
@TrippleXD545 2 жыл бұрын
but WHY are they different though?
@p_lambev
@p_lambev 2 жыл бұрын
very useful, thanks!
@fulgencejuniorlohore854
@fulgencejuniorlohore854 3 жыл бұрын
Useful!
@PhilippeLhermie
@PhilippeLhermie 3 жыл бұрын
Always interesting as usual... But what happened to your voice???? Where is the Castafiore??? ;)
@tutorialsEU
@tutorialsEU 3 жыл бұрын
I caught a cold ;).
@adammichael6959
@adammichael6959 3 жыл бұрын
How to create a desktop clock(widget) in C# for window 10? Can you make a tutorial on that please?
@bojohannesen4352
@bojohannesen4352 5 ай бұрын
Why the hell would you put background music on this type of video? Jfc!
What is a C# Delegate and how does it help my code? + Example
17:54
C# TryParse - Converting strings in other data types
7:28
tutorialsEU - C#
Рет қаралды 6 М.
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 994 М.
The New Way of Parsing ANY Type in .NET
13:03
Nick Chapsas
Рет қаралды 71 М.
C# LAMBDA Expressions and ANONYMOUS Functions Tutorial | 2021
14:30
C# type casting 💱
7:15
Bro Code
Рет қаралды 57 М.
What are ASYNC and AWAIT in C#? Asynchronous Programming Tutorial
18:34
All Rust string types explained
22:13
Let's Get Rusty
Рет қаралды 194 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 340 М.
C# abstract classes and methods in 8 minutes
8:20
tutorialsEU - C#
Рет қаралды 13 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 628 М.
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН