https://www.youtube.com/watch?v=ycUhM86Qf3Q&list=PLO56HZSjrPTB4NxAsEP8HRk6YKBDLbp7m&index=72
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.Reflection;
namespace testProject
{
static class StringExtension
{
public static string Ten(this string message) => message.Substring(0, 10);
public static string Five(this string message) => message.Substring(0, 5);
public static string AddElipsis(this string message) => message + "...";
public static string AddElipsis(this string message, string elipsis) => $"{message}{elipsis}";
}
class Program
{
static void Main(string[] args)
{
string message = "안녕하세요. 반갑습니다. 또 만나요.";
WriteLine(message.Ten());
WriteLine(message.Ten().Five());
WriteLine(message.Five());
WriteLine(message.Five().AddElipsis());
WriteLine(message.Five().AddElipsis("hihi"));
}
}
}