Hi @Anonymous , Welcome to Microsoft Q&A,
Updated:
Maybe during programming, it will suggest you change the type declaration to var and give a message about it.
You can use a #pragma to circumvent these warnings.
You seem to have misunderstood the type you want to copy, it is the type of your variable that VS automatically infers.
It is just a reminder for you, it is not selectable.
If you don't like it, you can disable it in the settings.
When you use the var
keyword in your code (such as var myVariable = 10;
), Visual Studio will automatically infer the type of myVariable
to be int
.
- Go to Tools > Options.
- Under Text Editor > C# > Code Style > General, you can find the relevant options for using
var
.
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.