Need some pragmatic help here

Can anyone plz. explain why this works -eventhough the method parameter name is set to ‘text’ rather than ‘x’:
var sentence = ‘‘this is a text’’;
var x = SummeriseText(sentence);
Console.WriteLine(x);
public static string SummeriseText (string text )
– if I change the method parameter name to ‘hellothere’(or any other string), it will still work I suppose

while , this will ‘‘only’’ work , if ‘name’ is there in the method parameter name:
var name = Console.ReadLine();
var x= ReverseName(name);
Console.WriteLine("Reversed name: " + x);

    public static string ReverseName(string name)

! but if I change the method parameter name to ‘z’ (or any other string) , this will not work.(I was told method signature changes)

-so for the 1st one , method paramater name could be different , and it works …i,e ‘text’ will recieve ‘sentence’ and pass it to ‘x’.

-for the 2nd one , paramater name MUST NOT be different , and then only it will work. if method parameter name was ‘crazy’ instead of ‘name’ , ‘crazy’ will NOT recieve ReverseName(name); .Only if method parameter is ‘‘name’’ will it recieve:ReverseName(name)

I am learning my ropes with csharp at present & this ‘not cohorent’ way of calling methods is confusing :smiling_face_with_tear:

1 Like

Okay, thanks everyone. After some dilly-dallying, I think I understand it now. Let’s bring closure to this topic.