4
나는 내가 사용하고있는 수업에서 다음 줄을 사용했다.지연의 차이 <T>과 LazyInit <T>
private static readonly LazyInit<TestClass> _instance = new LazyInit<TestClass>(() => new TestClass(), LazyInitMode.EnsureSingleExecution);
언젠가 .NET 4와 함께 제공되는 모든 새로운 기능에 도움이되고 싶었고 설치가 느슨했습니다.
내 LazyInit은 더 이상 작동하지 않습니다. 그래서 저는 모든 경우를 Lazy <T>으로 바꿨지 만, LazyInitMode.EnsureSingleExecution
은 어떨까요?
나는 LazyThreadSafetyMode.ExecutionAndPublication
이라고 생각했습니다.
private static Lazy<LookupService> s_instance = new Lazy<LookupService>(() => new LookupService(), LazyThreadSafetyMode.ExecutionAndPublication);
이 두 declerations는 동등한가요?