|
MyMostExcellentPDFCreateAndReaderAndEmailer pdfWhatever = new MyMostExcellentPDFCreateAndReaderAndEmailer()
or
var pdfWhatever = new MyMostExcellentPDFCreateAndReaderAndEmailer()
It is just neater and you know the type because of the instantiation.
BTW, ReSharper is such a great tool, that Microsoft is duplicating its functionality and baking it into their own IDE starting with VS2017 + updates.
Also, a lot of the devs at Microsoft, use ReSharper.
|
|
|
|
|
Excellent example. "var" is hiding the actual problem which is your terribly named class.
|
|
|
|
|
|
Strange conclusion. Most people would say putting type names in functions is a newbie mistake.
var intAge = GetAgeAsInt();
Cool code, bro. I love how you use one anti-pattern to solve another
Edit: lol thought we were talking about calling methods, not defining variables, that's not really the issue.
|
|
|
|
|
|
This isn't the soapbox, if all you're going to do is troll then don't bother posting at all.
|
|
|
|
|
var is more than accepted when used correctly. To argue this makes you look like a newbie. Get over it.
See my reply to the the OP as well.
Other than that,
|
|
|
|
|
Slacker007 wrote: var is more than accepted when used correctly.
We're talking about using it everywhere as dictated by these tools so you're fighting straw-man arguments.
Nice edit BTW, but I saw the comments before you deleted them, probably because you realised what a hypocrite they made you sound.
|
|
|
|
|
|
#Troll, troll, troll your boat....#
|
|
|
|
|
I can do this all day long.
|
|
|
|
|
Troll? I know you can, it's a shame you just don't keep it to the appropriate forum.
|
|
|
|
|
|
You: You're acting like a child
Also you: everything you've posted on this thread
|
|
|
|
|
Ok. You win.
|
|
|
|
|
If god had meant for man to use var , he wouldn't have given us intrinsic types.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Three guesses as to the programmer's previous coding experience:
- VB
- Ruby
- Javascript
|
|
|
|
|
You forgot PHP where you can shove everything into everything
Rules for the FOSW ![ ^]
if(!string.IsNullOrWhiteSpace(_signature))
{
MessageBox.Show("This is my signature: " + Environment.NewLine + _signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Surprisingly enough, it's C#.
The guy probably found dynamic online and having no experience in anything else than limited C# thought this was the right way to go.
|
|
|
|
|
I love var , but in the example you have posted, of course, that is an incorrect way to use it.
|
|
|
|
|
It is what make JavaScript so popular. The ability to assign anything to any variable, exists or not. Make life worth living.
|
|
|
|
|
But this isn't JavaScript and it doesn't work like that in C#.
|
|
|
|
|
|
Disclaimer: Not mine. Also might be considered NSFW due to language.
I ran into this in the comments in r/shittyprogramming[^] - FOAAS[^]. I've had way too much fun appeasing my inner teenager. Happy Monday!
|
|
|
|
|