Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 46e9f96

Browse files
formatting
1 parent 874d250 commit 46e9f96

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

‎StatePattern/Program.cs

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,58 @@
22

33
namespace StatePattern
44
{
5-
interface IWritingState {
5+
interface IWritingState
6+
{
67

7-
void Write(string words);
8+
void Write(string words);
89

9-
}
10+
}
1011

11-
class UpperCase : IWritingState
12-
{
13-
public void Write(string words)
12+
class UpperCase : IWritingState
1413
{
15-
Console.WriteLine(words.ToUpper());
14+
public void Write(string words)
15+
{
16+
Console.WriteLine(words.ToUpper());
17+
}
1618
}
17-
}
1819

19-
class LowerCase : IWritingState
20-
{
21-
public void Write(string words)
20+
class LowerCase : IWritingState
2221
{
23-
Console.WriteLine(words.ToLower());
22+
public void Write(string words)
23+
{
24+
Console.WriteLine(words.ToLower());
25+
}
2426
}
25-
}
2627

27-
class DefaultText : IWritingState
28-
{
29-
public void Write(string words)
28+
class DefaultText : IWritingState
3029
{
31-
Console.WriteLine(words);
30+
public void Write(string words)
31+
{
32+
Console.WriteLine(words);
33+
}
3234
}
33-
}
3435

35-
class TextEditor {
36+
class TextEditor
37+
{
3638

37-
private IWritingState mState;
39+
private IWritingState mState;
3840

39-
public TextEditor()
40-
{
41-
mState = new DefaultText();
42-
}
41+
public TextEditor()
42+
{
43+
mState = new DefaultText();
44+
}
4345

44-
public void SetState(IWritingState state)
45-
{
46-
mState = state;
47-
}
46+
public void SetState(IWritingState state)
47+
{
48+
mState = state;
49+
}
4850

49-
public void Type(string words)
50-
{
51-
mState.Write(words);
52-
}
51+
public void Type(string words)
52+
{
53+
mState.Write(words);
54+
}
5355

54-
}
56+
}
5557

5658
class Program
5759
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /