I have a prototype:
int[] medianFileter(int[] data);
and an array
int[] intVal = new int[5];
How can I pass the intVal to the prototype in C#?
-
I don't understand how someone with 962 rep. and 2 silver badges ask such a simple question.kay.one– kay.one2009年07月07日 05:30:38 +00:00Commented Jul 7, 2009 at 5:30
-
1Because maybe his 964 (now) reputation points came from expertise in another programming language? This isn't a C# specific site.scwagner– scwagner2009年07月07日 06:00:26 +00:00Commented Jul 7, 2009 at 6:00
4 Answers 4
Um, you just call it (assuming you've got a real implementation to call):
int[] result = medianFileter(intVal);
Note that any changes made to the array within the method will show up in intVal
: you're not passing each of the integers individually, but a reference to the whole array.
(There could be some trickiness here due to your use of the word "prototype" - it's not standard C# terminology, so I'm not exactly sure what you mean. If you could clarify the question, that would help.)
On a side note, method names in .NET are usually Pascal-cased, so this should probably be:
int[] result = ApplyMedianFilter(intVal);
1 Comment
It's either I don't see some obvious weirdness here, or it's just usual function invocation:
int[] medianFiltered = medialFileter(intVal);
Comments
This is what you would do,
medianFileter(intVal);
Comments
What's the problem with:
medianFileter(intVal);
?