Help with Functions
Here is the my code but I get an error saying "An object reference is required for the nonstatic field, method, or property Getname.function1(string, string" HELP!!!! :)
Thanks
Brad
class Getname
{
public static void Main(string[] args)
{
Console.WriteLine("Please enter your first and last name with one space");
string userName = Console.ReadLine();
Console.WriteLine(" ");
char[] separator = {' '};
string[] fullName;
fullName = userName.Split(separator);
string firstName = fullName[0];
string lastName = fullName[1];
char[] firstLetter = firstName.ToCharArray();
function1 (fullName[1], fullName[0]);
function2 (firstLetter[0], fullName[1]);
}
public void function1 (string lastName, string firstName)
{
Console.WriteLine("{0}", lastName + ", " + firstName);
}
public void function2( char firstLetter, string lastName)
{
Console.WriteLine("{0}", firstLetter + "." + " " + lastName);
}
}
}
|