TheNormalPotato TheNormalPotato - 5 months ago 19
C# Question

Passing one Method Parameters, To another method - c#

Is it possible to take parameters from one method to another?

Basiclly what I want to do is rename a method (in my case is The -

Method), Is there any way of creating a method with the name I want and have it take the parameters of another method like so:

void Func(Take The parametes of The .WriteLine method) //This is the rename of the method
Console.WriteLine(place them here);

Basiclly I want to rename a method.


If I understand your question correctly, all you want to do is pass an object to Func which should be passed on to the WriteLine method.

void Func(string SomeParameter) //This is the rename of the method     

SomeParameter will be passed to the Func method which calls Console.WriteLine. Use this function as :

Func("Hello World");

This should print the text "Hello World" on the output screen.