Hello World Day

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    Hello World Day

    I have been informed that today is Hello World Day, so in honor of that, I'd just like to say:
    Code:
    static void Main(string[] args)
    {
        int[] hwRevInt = { 33, 100, 108, 114, 111, 87, 32, 111, 108, 108, 101, 72 };
        for (int i = hwRevInt.Length - 1; i >= 0; i--)
            Console.Write((char)hwRevInt[i]);
        Console.ReadKey();
    }
    to you all!
    Last edited by Curtis Rutland; Nov 21 '08, 06:47 PM. Reason: I'll unstick this tomorrow
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    "dlroW olleH".Reverse( ) to all of you too

    Comment

    • balabaster
      Recognized Expert Contributor
      • Mar 2007
      • 798

      #3
      Code:
      Private DoWork As New ManualResetEvent(False)
      Private Shutdown As Boolean = False
      Private Queue As New Queue(Of String)
      
      Private Sub ProcessThread(ByVal Args As Object)
      
              Dim Working As Boolean = True
      
              'Process message queue...
              While Working
      
                  DoWork.WaitOne()
      
                  If Not Shutdown Then
      
                      Dim NextMessage As String = Queue.Dequeue
                      Console.WriteLine(NextMessage)
      
                      SyncLock Queue
                          If Queue.Count = 0 Then
                              DoWork.Reset()
                          End If
                      End SyncLock
      
                  Else
                      Working = False
      
                  End If
      
              End While
      
      End Sub
      
      Private Sub QueueMessage(ByVal Message As String)
      
              'Add message to the message queue...
              SyncLock Queue
                  Queue.Enqueue(Message)
                  DoWork.Set()
              End SyncLock
      
      End Sub
      
      Sub Main()
      
              'Start worker thread
              Dim oWorkThread As New Thread(AddressOf ProcessThread)
              oWorkThread.Start()
      
              'Queue up message
              QueueMessage("Hello World")
      
              Console.Write("Press a key to exit")
              Console.ReadKey()
      
              Shutdown = True
              DoWork.Set()
              oWorkThread.Join()
      
      End Sub

      Comment

      Working...