C
C#10mo ago
avoidenz

I don't really get how to create new methods for my code. Yesterday people told me it's got no body.

Didn't really understand anything when i did research. It's probably a quick fix : ] I'm talking about the bubblesort method im trying to create
No description
19 Replies
TheRanger
TheRanger10mo ago
remove ; after private void BubbleSort()
avoidenz
avoidenz10mo ago
NAH AINT NO WAY it works i hate my life thank you xddd well i put the code in and stuff right but i can't use the method?
TheRanger
TheRanger10mo ago
what method?
avoidenz
avoidenz10mo ago
the bubble sort. i tried to send in a sc but my pc is dying
TheRanger
TheRanger10mo ago
why can't u use it?
avoidenz
avoidenz10mo ago
hey sorry my pc crashed
avoidenz
avoidenz10mo ago
No description
TheRanger
TheRanger10mo ago
well, hover on the red line and read the error message
avoidenz
avoidenz10mo ago
yeah it has no definition for bubblesort. but i don't get how to fix it :/
phaseshift
phaseshift10mo ago
You defined bubble sort as a method on MainWindow Please tell me what type is your variable
TheRanger
TheRanger10mo ago
your method belongs to your current class, not List<int> its in the screenshot
avoidenz
avoidenz10mo ago
but writing it out of mainwindow just gives me 10000 error codes
TheRanger
TheRanger10mo ago
no 1 said you need to write it out of mainwindow
avoidenz
avoidenz10mo ago
oh i thought he meant that by that
TheRanger
TheRanger10mo ago
u are trying to call BubbleSort() on an instance of List<int> however your BubbleSort() method is defined in your MainWindow class so you need to call it on an instance of MainWindow, not List<int> so write this.BubbleSort(); the this keyword refers to the current instance of the current class
avoidenz
avoidenz10mo ago
okayokay It's working but imma have to read into that more thank you
TheRanger
TheRanger10mo ago
well, you can look in links below to help you learn more fundamentals about C# $helloworld
Accord
Accord10mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts