https://www.youtube.com/watch?v=7XtfWhT4hp0&list=PLO56HZSjrPTB4NxAsEP8HRk6YKBDLbp7m&index=60
public void PrintMessage(string messege, string prefix = "", string suffix ="")
{
WriteLine($"{prefix}-{message}-{suffix}");
}
using System;
using System.Collections.Generic;
using System.Text;
namespace testProject
{
class Car
{
public void Map(string title) => Console.WriteLine($"[2]{title}");
}
}
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
string title = "복사";
WriteLine($"[1]{title}");
Car car = new Car();
car.Map(title);
WriteLine($"[3]{title}");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace testProject
{
class Car
{
public void Map(ref string title)
{
title = "참조 변경";
Console.WriteLine($"[2]{title}");
}
}
}
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
string title = "복사";
WriteLine($"[1]{title}");
Car car = new Car();
car.Map(ref title);
WriteLine($"[3]{title}");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace testProject
{
class Car
{
public void Map(out string title)
{
title = "참조 변경";
Console.WriteLine($"[2]{title}");
}
}
}
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
string title;
Car car = new Car();
car.Map(out title);
WriteLine($"[3]{title}");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace testProject
{
class Car
{
public void Map(params string[] titles)
{
foreach(string title in titles)
{
Console.WriteLine(title);
}
}
}
}
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
Car car = new Car();
car.Map("유재석", "강호동");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace testProject
{
class Car
{
public void Map(string title, string subTitle = "부제목")
{
Console.WriteLine($"{title}({subTitle})");
}
}
}
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
Car car = new Car();
car.Map("C#");
car.Map("C#", "C#교과서 마스터하기");
car.Map(subTitle: "프로그래밍언어", title: "C#");
}
}
}