C
C#14mo 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
TheRanger14mo ago
remove ; after private void BubbleSort()
avoidenz
avoidenzOP14mo 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
TheRanger14mo ago
what method?
avoidenz
avoidenzOP14mo ago
the bubble sort. i tried to send in a sc but my pc is dying
TheRanger
TheRanger14mo ago
why can't u use it?
avoidenz
avoidenzOP14mo ago
hey sorry my pc crashed
avoidenz
avoidenzOP14mo ago
No description
TheRanger
TheRanger14mo ago
well, hover on the red line and read the error message
avoidenz
avoidenzOP14mo ago
yeah it has no definition for bubblesort. but i don't get how to fix it :/
phaseshift
phaseshift14mo ago
You defined bubble sort as a method on MainWindow Please tell me what type is your variable
TheRanger
TheRanger14mo ago
your method belongs to your current class, not List<int> its in the screenshot
avoidenz
avoidenzOP14mo ago
but writing it out of mainwindow just gives me 10000 error codes
TheRanger
TheRanger14mo ago
no 1 said you need to write it out of mainwindow
avoidenz
avoidenzOP14mo ago
oh i thought he meant that by that
TheRanger
TheRanger14mo 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
avoidenzOP14mo ago
okayokay It's working but imma have to read into that more thank you
TheRanger
TheRanger14mo ago
well, you can look in links below to help you learn more fundamentals about C# $helloworld
Accord
Accord14mo 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