String.Format expects an index in the braces. You want to pass the name in it, so you can replace it with the actual name value. I'd suggest to use String.Replace:
public static string GetHelloGreeting(string template, string name) { return template.Replace("{name}", name); }
You could provide a method which is more reusable. For example:
public static string ReplaceAll(string template, params (string key, string value)[] replacements) { foreach (var kv in replacements) { template = template.Replace("{"+ kv.key + "}", kv.value); } return template; }
Your example:
string res = ReplaceAll("Hello, {name}!", ("name", "Bob"));
but also possible with multiple parameters:
string res = ReplaceAll("Hello, {name}! Now it's {time}", ("name", "Bob"), ("time", DateTime.Now.ToString("HH:mm")));
GetHelloGreeting.String.Formatcan do that, but only with indexes not with names. While some answers(in your links) suggest third party libraries which support it, it will not help OP because he said that he's a beginner and got a task(probably from the teacher).