context: // **********************************************************************
  //
  // Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
  //
  // This copy of Ice is licensed to you under the terms described in the
  // ICE_LICENSE file included in this distribution.
  //
  // **********************************************************************
  
  using System;
  using System.Collections.Generic;
  using Test;
  
  class Twoways
  {
      private static void test(bool b)
      {
          if(!b)
          {
              throw new Exception();
          }
      }
  
      static int _length = 100;
  
      internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p)
      {
          {
              byte[] i = new byte[_length];
              for(int c = 0; c < _length; ++c)
              {
                  i[c] = (byte)c;
              }
              byte[] o;
              byte[] r;
  
              r = p.opAByteS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              List<byte> i = new List<byte>(_length);
              for(int c = 0; c < _length; ++c)
              {
                  i.Add((byte)c);
              }
              List<byte> o;
              List<byte> r;
  
              r = p.opLByteS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              LinkedList<byte> i = new LinkedList<byte>();
              for(int c = 0; c < _length; ++c)
              {
                  i.AddLast((byte)c);
              }
              LinkedList<byte> o;
              LinkedList<byte> r;
  
              r = p.opKByteS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              Queue<byte> i = new Queue<byte>();
              for(int c = 0; c < _length; ++c)
              {
                  i.Enqueue((byte)c);
              }
              Queue<byte> o;
              Queue<byte> r;
  
              r = p.opQByteS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              Stack<byte> i = new Stack<byte>();
              for(int c = 0; c < _length; ++c)
              {
                  i.Push((byte)c);
              }
              Stack<byte> o;
              Stack<byte> r;
  
              r = p.opSByteS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              CByteS i = new CByteS(_length);
              for(int c = 0; c < _length; ++c)
              {
                  i.Add((byte)c);
              }
              CByteS o;
              CByteS r;
  
              r = p.opCByteS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              bool[] i = new bool[_length];
              for(int c = 0; c < _length; ++c)
              {
                  i[c] = c % 1 == 1;
              }
              bool[] o;
              bool[] r;
  
              r = p.opABoolS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              List<bool> i = new List<bool>(_length);
              for(int c = 0; c < _length; ++c)
              {
                  i.Add(c % 1 == 1);
              }
              List<bool> o;
              List<bool> r;
  
              r = p.opLBoolS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              LinkedList<bool> i = new LinkedList<bool>();
              for(int c = 0; c < _length; ++c)
              {
                  i.AddLast(c % 1 == 1);
              }
              LinkedList<bool> o;
              LinkedList<bool> r;
  
              r = p.opKBoolS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              Queue<bool> i = new Queue<bool>();
              for(int c = 0; c < _length; ++c)
              {
                  i.Enqueue(c % 1 == 1);
              }
              Queue<bool> o;
              Queue<bool> r;
  
              r = p.opQBoolS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              Stack<bool> i = new Stack<bool>();
              for(int c = 0; c < _length; ++c)
              {
                  i.Push(c % 1 == 1);
              }
              Stack<bool> o;
              Stack<bool> r;
  
              r = p.opSBoolS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              CBoolS i = new CBoolS(_length);
              for(int c = 0; c < _length; ++c)
              {
                  i.Add(c % 1 == 1);
              }
              CBoolS o;
              CBoolS r;
  
              r = p.opCBoolS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              short[] i = new short[_length];
              for(int c = 0; c < _length; ++c)
              {
                  i[c] = (short)c;
              }
              short[] o;
              short[] r;
  
              {
                  r = p.opAShortS(i, out o);
              }
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              List<short> i = new List<short>(_length);
              for(int c = 0; c < _length; ++c)
              {
                  i.Add((short)c);
              }
              List<short> o;
              List<short> r;
  
              r = p.opLShortS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              LinkedList<short> i = new LinkedList<short>();
              for(int c = 0; c < _length; ++c)
              {
                  i.AddLast((short)c);
              }
              LinkedList<short> o;
              LinkedList<short> r;
  
              r = p.opKShortS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              Queue<short> i = new Queue<short>();
              for(int c = 0; c < _length; ++c)
              {
                  i.Enqueue((short)c);
              }
              Queue<short> o;
              Queue<short> r;
  
              r = p.opQShortS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              Stack<short> i = new Stack<short>();
              for(int c = 0; c < _length; ++c)
              {
                  i.Push((short)c);
              }
              Stack<short> o;
              Stack<short> r;
  
              r = p.opSShortS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              CShortS i = new CShortS(_length);
              for(int c = 0; c < _length; ++c)
              {
                  i.Add((short)c);
              }
              CShortS o;
              CShortS r;
  
              r = p.opCShortS(i, out o);
  
              test(Ice.CollectionComparer.Equals(i, o));
              test(Ice.CollectionComparer.Equals(i, r));
          }
  
          {
              int[] i = new int[_length];
  
gt:             for(int c = 0; c < _length; ++c)