Skip to content

Instantly share code, notes, and snippets.

@Adobe-Android
Created February 1, 2019 03:37
Show Gist options
  • Save Adobe-Android/fe05e0ba2bda63034b18d03d4be2443d to your computer and use it in GitHub Desktop.
Save Adobe-Android/fe05e0ba2bda63034b18d03d4be2443d to your computer and use it in GitHub Desktop.
Demo for creating a new object/type and creating an instance method on that class
namespace Class_Instance_Method
{
class Employee
{
public string Id { get; set; }
public string FullName { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string doWork()
{
return "Work has been completed by";
}
}
}
using System;
namespace Class_Instance_Method
{
class Program
{
static void Main(string[] args)
{
Employee employee = new Employee();
employee.FullName = "Brown, David";
var doWorkStr = employee.doWork();
Console.WriteLine($"{doWorkStr} {employee.FullName}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment