CSharp examples for Custom Type:Method
Invoke a member method through the object.
using System;// ww w .j ava 2s. c o m class Student { public string firstName; public string lastName; public void SetName(string fName, string lName) { firstName = fName; lastName = lName; } public string ToNameString() { string s = firstName + " " + lastName; return s; } } public class Program { public static void Main() { Student student = new Student(); student.SetName("S", "D"); Console.WriteLine("Student's name is " + student.ToNameString()); } }