MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/sffyr6/discount_constructor/huq486f/?context=3
r/badcode • u/catithebathtub • Jan 29 '22
30 comments sorted by
View all comments
80
[removed] — view removed comment
34 u/QuinteOne Jan 29 '22 edited Jan 29 '22 In VS, you can extract a method based on a call that has no defined method. VS suggests then to extract/write the method for you. In C#, the extracted method of int dot = Sales.force(x: 1, y: 2.0); will generate below the line: private class Sales { private int force(int x, decimal y) { throw new NotImplementedException(); } } Something like that probably happened. OP wanted to use a number that that had a decimal part .0, I didn't write it. So VS assumes it was an int. 44 u/catithebathtub Jan 29 '22 no, normally both width and height are integers but i made the height parameter a float because im an idiot... 20 u/Naeio_Galaxy Jan 29 '22 Nah nah you're not idiot, it's just not your brightest day
34
In VS, you can extract a method based on a call that has no defined method. VS suggests then to extract/write the method for you.
In C#, the extracted method of
int dot = Sales.force(x: 1, y: 2.0);
will generate below the line:
private class Sales { private int force(int x, decimal y) { throw new NotImplementedException(); } }
Something like that probably happened. OP wanted to use a number that that had a decimal part .0, I didn't write it. So VS assumes it was an int.
44 u/catithebathtub Jan 29 '22 no, normally both width and height are integers but i made the height parameter a float because im an idiot... 20 u/Naeio_Galaxy Jan 29 '22 Nah nah you're not idiot, it's just not your brightest day
44
no, normally both width and height are integers but i made the height parameter a float because im an idiot...
20 u/Naeio_Galaxy Jan 29 '22 Nah nah you're not idiot, it's just not your brightest day
20
Nah nah you're not idiot, it's just not your brightest day
View all comments
80
u/[deleted] Jan 29 '22
[removed] — view removed comment