How to wait for particular function to complete for starting next function? Without using thread in C#
<p>I have two functions.</p>

<pre><code>Function1(varName);
Function2();
</code></pre>

<p>called in same sequence.
Here String <code>varName</code> is assigned by another function call which is in thread.</p>

<p>But here I want Funtion2 to complete before another value is assigned to varName (Funtion1 is called).</p>

<p>regards,
Sagy</p>

<p>example:</p>

<pre><code>private void MainFuntion()
{
   Thread StartReadThread = new Thread(
            new ParameterizedThreadStart(StartRead));
   StartReadThread .Start(obj_ListDictionary); //ListDictionary object 
}

private void StartRead(object threadData)**
{
  ThreadPool.SetMaxThreads(4, 4);
  m_Events = new ManualResetEvent[m_objSelNsfDataTable.Rows.Count];
  foreach (DataRow objRow in m_objSelNsfDataTable.Rows)
  {
    m_objThreadData                 =   new ThreadData();
    m_objThreadData.FilePath         =   objRow[0].ToString();

    m_objThreadData.ThreadIndex      =   index;
    m_Events[index]                  =   new ManualResetEvent(false);

    WaitCallback objWcb             =   new WaitCallback(FinalFunction);
    ThreadPool.QueueUserWorkItem(objWcb, m_objThreadData);

    index++; 
  }                               

  WaitHandle.WaitAll(m_Events); 
}

private void FinalFunction(object threadData)
{

  ThreadData threadData = (ThreadData)passedThreadData;
  String FilePath = threadData.FilePath;
  CopyContent(FilePath );                    
  OpenFolderForView();

}
</code></pre>
