|
This usually happens by accident when they implement the property before defining the accompanying field. It's happened to me a couple of times.
I compile at the highest warning level and VS2013 doesn't catch this error at compile time.A "self-referencing property" compile-time warning would be nice to have.
".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
|
|
|
|
|
What else would expect from a coder who can't spell 'length' ?
|
|
|
|
|
|
That was the first stupidity I saw the misspelling.
|
|
|
|
|
The useless FileNotFoundException catch is more offensive.
This space for rent
|
|
|
|
|
I like the optimistic (and useless) initialization of port in this snippet.
int port = 4401;
Int32.TryParse(strPort, out port);
peer.EndPoint = new IPEndPoint(address, port); /ravi
|
|
|
|
|
I'm fine with that. When debugging, you might want to skip over the call to TryParse yet have a valid value in Port.
|
|
|
|
|
PIEBALDconsult wrote: When debugging, you might want to skip over the call to TryParse yet have a valid value in Port. In that case I would #if DEBUG it.
The way it's written implies the developer assumes port will have the value 4401 if the Int32.TryParse() fails.
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: implies the developer assumes
I disagree.
|
|
|
|
|
You can manually set values for variables while debugging C#, so initialization isn't necessary (but convenient nonetheless, although I'd remove it when done debugging)
|
|
|
|
|
Sure, but why not simply code the value you want?
|
|
|
|
|
Well, since that's the wrong spelling for 'length' it's safe to assume it will only be called by an error - so if it recalls itself until it crashes, nothing's really been lost, anyway.
Thus, the balance is restored in this, the best of all possible worlds.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I suspect that the code comes from a keyboard dyslexic like myself. Since he/she regularly mis-types lenght (see?) they though it would be a good idea to cater for it... unofrtuantely they misspselt it in the function too.
|
|
|
|
|
I recently started working with Python. The IDE I use highlights every potential typo and stylistic error as I type. A variable name like Lenght would be flagged immediately, even though it is syntactically legal.
My goal when coding with the IDE is zero flaggings of code. In the long run it is worth it.
|
|
|
|
|
BucketList:
1. Learn how to write code.
2. Improve this code.
3. Climb the Mount Everest.
|
|
|
|
|
4. Stay there, not bothering anybody.
|
|
|
|
|
A lot of people should add that to their list
|
|
|
|
|
isnt that a recursive call which should crash the stack
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: isnt that a recursive call which should crash the stack
Exactly.
|
|
|
|
|
|
How would this even work, given that "Lenght" is misspelled in both places?
|
|
|
|
|
|
You quit without finding a new job first? Possibly a little premature ... have you been reading GlennPatton-in-the-pub/not-in-the-pub/back-in-the-pub has been posting for the last year?
Good luck - I hope you won't need it!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: Possibly a little premature Not at all, I've calculated my risk and it's basically none
OriginalGriff wrote: Good luck - I hope you won't need it! Thanks - and I won't!
|
|
|
|
|
Still..."unforeseen circumstances" are a thing. It can happen both to you and potential employers.
Even with 2 opportunities lined up, I still wouldn't quit a job without having anything in writing yet. But maybe that's just me. I'm in my mid-40s and have never quit a job.
|
|
|
|