Example #1
0
 //thread-safe execute dtocontainer from list
 private DTOContainer ThreadSafeExecute()
 {
     lock (threadLock) {
         DTOContainer tmpContainer = new DTOContainer();
         tmpContainer = dtoObject.Items.ElementAt(index);
         index++;
         return(tmpContainer);
     }
 }
Example #2
0
        //create .cs file
        private void CreateCSFile(object state)
        {
            lock (threadLock) {
                dtoContainer = ThreadSafeExecute();
                var outputFileName = path + dtoContainer.ClassName + ".cs";
                var generatedCode  = GenerateClassCode();
                File.WriteAllText(outputFileName, generatedCode);
            }

            semaphore.Release();
        }