We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents afd09a7 + 28344e7 commit cd090a0Copy full SHA for cd090a0
1 file changed
1.md
@@ -198,7 +198,7 @@ public class Factory
198
199
private static class Cache<T>
200
{
201
- public static T Instance = new T();
+ public static readonly T Instance = new T();
202
}
203
204
```
@@ -215,9 +215,9 @@ public class Factory
215
216
217
218
- public static T Instance = CallExpensiveMethodToBuildANewInstance();
+ public static readonly T Instance = CallExpensiveMethodToBuildANewInstance();
219
220
- public static T CallExpensiveMethodToBuildANewInstance()
+ private static T CallExpensiveMethodToBuildANewInstance()
221
222
// Imagine a really complex process to construct T
223
return instance.
0 commit comments