可以使用Lazy簡化初始化代碼 static Lazy<SemaphoreSlim> pool = null;public Handler(IConfiguration configuration){ int poolSize = configuration.GetValue("PoolSize", 3); pool = new Lazy<SemaphoreSlim>(() => new SemaphoreSlim(10), LazyThreadSafetyMode.ExecutionAndPublication);} 它的工作原理與您現有的代碼類似,但我總是更喜歡在可用時使用框架方法來進行thread-related工作,因為這些方法是由工程師優化的,他們對threading的理解遠遠好于普通bear。