5
Answers

[Newbie] Arraylist Issue...please help

Sherwin Hamidi

Sherwin Hamidi

18y
2.2k
1
So I'm new to C#, haven't used C++ in a while and when I did I had the luxury of VS 2003....not anymore....don't ask why, but these are the times I'm in.

So I have an ArrayList which I'm 99% positive is populated correctly in one class -- I passed it to another class with a simple Get and now I'm trying to do nothing but System.Console.Writeline the data in the ArrayList.

Here's the thing -- the ArrayList is composed of many arrays -- each array has n elements so in essence I've created a matrix.  To display this matrix (after defining the ArrayList of course) I've used this simple function which I'm sure everyone has seen before.

public static void PrintValues( IEnumerable myList )
 {
  foreach ( Object obj in myList )
   Console.Write( "   {0}", obj );
  Console.WriteLine();
 }

Here's where my lack of C# knowledge comes in.  The only thing being printed in my Output box at this moment is the first element in the array.....the other n-1 elements are not being printed.  So for each array I'm getting the first element, (so right now 26 individual strings are being printed since I have 26 arrays in my ArrayList) but I need to know how to get access to the other n-1 elements in the individual arrays!  Can anyone help?
Answers (5)
0
Bechir Bejaoui
NA 20.1k 5.3m 16y

In this case you have to implement security logic, the .Net provides an entire API  System.Security, you can create a permission set that determines rule of messages transactions 
0
Riccardo
NA 5 0 16y
I mean every outgoing mail of a company (mail from a internal network to outside the network)
0
Bechir Bejaoui
NA 20.1k 5.3m 16y

What do you mean by outgoing mail, do you mean from example a spam?
0
Riccardo
NA 5 0 16y
Thank you very much for your answer!

Probably I should explain a little bit more about the functionality I would like to implement. Basicaly I would like to check every outgoing mail. Therefore I would like to
1. stop the smtp queue
2. wait for messages
3.check these messages (allowed or unallowed and probably remove some of them)
4. Start the smtp queue, so the messages can be send


0
Bechir Bejaoui
NA 20.1k 5.3m 16y

If I well understand your question you're using a Message queue object then you can do

MessageQueue mqueue = new MessageQueue();
            //This method will make the message queue in a standby state for any message
            IAsyncResult Async = mqueue.BeginReceive();

            //TO do perform you code here

            //This method
            Message Recived = mqueue.EndReceive(Async);
           
            //close the message queue
            mqueue.Close();
It's better to do that asynchormously