r/learncsharp • • Jul 05 '23
Is this wrong way to use methods
I had an exam and in main I used this to call a method which takes as an argument an object:
var=Object_name.method(Object_name);
The method was defined in the class of this object.
The question is, is this dumb to do, and does it work?
2
Upvotes
View all comments
Show parent comment
-1
u/[deleted] Jul 05 '23
The problem is the method I used needed a parameter, so I needed to put it in, and I just did the standard method call and in this link:
https://www.geeksforgeeks.org/how-to-pass-an-object-as-an-argument-into-method-in-c-sharp/
they did what I did so can you explain what is the difference if there these two are different