dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.18k stars 5.85k forks source link

Can we have a description about whether this error fixed automatically during compiling or is actually casting while running #24691

Open Xyncgas opened 3 years ago

Xyncgas commented 3 years ago

[Enter feedback here]


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

gewarren commented 2 years ago

@mavasani Does the compiler remove the cast?

mavasani commented 2 years ago

I think that will vary from case to case. Tagging @jcouv from the compiler team if there is a spec around this.

Xyncgas commented 2 years ago

to add to this, I was wondering if this warning means, I am having a cast that's unnecessary that's actually happening when my program is running, or the compile saw this as unnecessary and fixed it for me. this would affect my decision to whether use unnecessary cast, and I don't care whether it's a good coding style / practice according to who I am writing my program and I do get to write in whatever style I want and it does serve a purpose for me because I am trying to build a prototype application and a lot of things is not designed to work together because of the lack of the foresight (some component is using UInt64 some is using int) and that's fine by me, and rather than having exceptions throwing I want it to work before I figure out how to rewrite everything when I done building the application and start doing some refactors, I like these warnings don't get me want they are telling me where I am doing unnecessary cast which I probably know why and I am using it in order to later get back to these places

Xyncgas commented 2 years ago

Thanks for paying attention to this issues, I understand that it's part of your job and I do not intend to inject myself in your process