-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension_method.cs
More file actions
40 lines (35 loc) · 949 Bytes
/
extension_method.cs
File metadata and controls
40 lines (35 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace chapter7._5
{ //과제 1
//string.isEmpty() 구현
public static class CheckIsEmpty
{
public static bool isEmpty(this string myStr)
{
if(myStr == null || myStr == "")
{
return true;
}
return false;
}
}
class extension_method
{
static void Main(string[] args)
{
string tempstr1 = null;
string tempstr2 = "";
string tempstr3 = "Abc";
bool isflag = tempstr1.isEmpty();
Console.WriteLine($"{tempstr1} : {isflag}");
isflag = tempstr2.isEmpty();
Console.WriteLine($"{tempstr2} : {isflag}");
isflag = tempstr3.isEmpty();
Console.WriteLine($"{tempstr3} : {isflag}");
}
}
}