File tree Expand file tree Collapse file tree 8 files changed +11
-13
lines changed
AbstractFactory/MealSimpleFactory/Factories
Builder/CustomSandwichBuilder Expand file tree Collapse file tree 8 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public abstract class PatternExecutor
13
13
14
14
/// <summary>
15
15
/// The Execute method is the entry point of an executable design pattern example.
16
- /// When an arbitrary design pattern example is choosen from the command menu,
16
+ /// When an arbitrary design pattern example is chosen from the command menu,
17
17
/// the Execute method is the first method that is invoked.
18
18
/// </summary>
19
19
public abstract void Execute ( ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public MealFactory()
21
21
22
22
public IMeal CreateMeal ( string mealName )
23
23
{
24
- var type = GetTypeToCreate ( mealName ) ;
24
+ var type = GetTypeForCreation ( mealName ) ;
25
25
if ( type == null )
26
26
{
27
27
return new NullMeal ( ) ;
@@ -30,7 +30,7 @@ public IMeal CreateMeal(string mealName)
30
30
return Activator . CreateInstance ( type ) as IMeal ;
31
31
}
32
32
33
- private Type GetTypeToCreate ( string mealName )
33
+ private Type GetTypeForCreation ( string mealName )
34
34
{
35
35
if ( ! _meals . TryGetValue ( mealName , out Type type ) )
36
36
{
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ namespace CustomSandwichBuilder.Builders
7
7
{
8
8
/// <summary>
9
9
/// Concrete Builders provide different implementations of the construction steps.
10
- /// Concrete builders may produce products that don't follow the common interface.
10
+ /// Note that, concrete builders may produce products that don't follow the common interface.
11
11
/// </summary>
12
12
public class CheapSandwichBuilder : SandwichBuilder
13
13
{
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ namespace CustomSandwichBuilder.Builders
7
7
{
8
8
/// <summary>
9
9
/// Concrete Builders provide different implementations of the construction steps.
10
- /// Concrete builders may produce products that don't follow the common interface.
10
+ /// Note that concrete builders may produce products that don't follow the common interface.
11
11
/// </summary>
12
12
public class PremiumSandwichBuilder : SandwichBuilder
13
13
{
Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ public override void Execute()
34
34
private void MakeAndDisplaySandwich ( SandwichDirector director )
35
35
{
36
36
director . MakeSandwich ( ) ;
37
- var sandwich = director . GetSandwhich ( ) ;
38
37
38
+ var sandwich = director . GetSandwhich ( ) ;
39
39
sandwich . Display ( ) ;
40
40
}
41
41
}
Original file line number Diff line number Diff line change @@ -12,13 +12,10 @@ public override void Execute()
12
12
{
13
13
Console . WriteLine ( "Initial greetings..." ) ;
14
14
Console . WriteLine ( ) ;
15
-
16
15
Greet ( ) ;
17
- Console . WriteLine ( ) ;
18
16
19
- Console . WriteLine ( "Goodbye greetings..." ) ;
17
+ Console . WriteLine ( "\n Goodbye greetings..." ) ;
20
18
Console . WriteLine ( ) ;
21
-
22
19
Greet ( ) ;
23
20
}
24
21
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ private class Nested
28
28
/// </summary>
29
29
internal static readonly LocklessFullyLazyGreeter Instance = new LocklessFullyLazyGreeter ( ) ;
30
30
31
- // Explicit static constructor to tell C# compiler not to mark as BeforeFieldInit
31
+ // Explicit static constructor to tell C# compiler not to mark as BeforeFieldInit.
32
32
// http://csharpindepth.com/Articles/General/Singleton.aspx
33
33
static Nested ( )
34
34
{
Original file line number Diff line number Diff line change 3
3
namespace Greeter . Types
4
4
{
5
5
/// <summary>
6
- /// Why is it thread-safe? Well, static constructors in C# are specified to execute only when an instance of the class
6
+ /// Why is it thread-safe?
7
+ /// Well, static constructors in C# are specified to execute only when an instance of the class
7
8
/// is created or a static member is referenced, and to execute only once per AppDomain.
8
9
/// Given that this check for the type being newly constructed needs to be executed whatever else happens,
9
10
/// it will be faster than adding extra checking as in the DoubleCheckGreeter example.
@@ -15,7 +16,7 @@ public class LocklessGreeter : BaseGreeter
15
16
{
16
17
private static readonly LocklessGreeter InstanceValue = new LocklessGreeter ( ) ;
17
18
18
- // Explicit static constructor to tell C# compiler not to mark type as BeforeFieldInit
19
+ // Explicit static constructor to tell C# compiler not to mark type as BeforeFieldInit.
19
20
static LocklessGreeter ( )
20
21
{
21
22
}
You can’t perform that action at this time.
0 commit comments