Example #1
0
    public System.Single Add(System.Single xValue, System.Single yValue)
    {
// <Snippet2>
        SoapHeaderCollection mySoapHeaderCollection = new SoapHeaderCollection();
        MySoapHeader         mySoapHeader;

        mySoapHeader      = new MySoapHeader();
        mySoapHeader.text = "This is the first SOAP header";
        mySoapHeaderCollection.Add(mySoapHeader);
// </Snippet2>
// <Snippet3>
        mySoapHeader      = new MySoapHeader();
        mySoapHeader.text = "This is the second SOAP header";
        mySoapHeaderCollection.Add(mySoapHeader);
// </Snippet3>
// <Snippet4>
        mySoapHeader      = new MySoapHeader();
        mySoapHeader.text = "This header is inserted before the first header";
        mySoapHeaderCollection.Insert(0, mySoapHeader);
// </Snippet4>
// <Snippet5>
        mySoapHeaders = new MySoapHeader[mySoapHeaderCollection.Count];
        mySoapHeaderCollection.CopyTo(mySoapHeaders, 0);
// </Snippet5>
        object[] results = this.Invoke("Add",
                                       new object[] { xValue, yValue });
        return((System.Single)(results[0]));
    }
    public System.Single Add(System.Single xValue, System.Single yValue)
    {
        SoapHeaderCollection mySoapHeaderCollection = new SoapHeaderCollection();
        MySoapHeader         myFirstSoapHeader;

        myFirstSoapHeader      = new MySoapHeader();
        myFirstSoapHeader.Text = "This is the first soap header";
        mySoapHeaderCollection.Add(myFirstSoapHeader);

        MySoapHeader mySecondSoapHeader = new MySoapHeader();

        mySecondSoapHeader.Text = "This is the second soap header";
        mySoapHeaderCollection.Add(mySecondSoapHeader);
// <Snippet1>
        // Check to see whether the collection contains mySecondSoapHeader.
        if (mySoapHeaderCollection.Contains(mySecondSoapHeader))
        {
            // Get the index of mySecondSoapHeader from the collection.
            Console.WriteLine("Index of mySecondSoapHeader: " +
                              mySoapHeaderCollection.IndexOf(mySecondSoapHeader));

            // Get the SoapHeader from the collection.
            MySoapHeader mySoapHeader1 = (MySoapHeader)mySoapHeaderCollection
                                         [mySoapHeaderCollection.IndexOf(mySecondSoapHeader)];
            Console.WriteLine("SoapHeader retrieved from the collection: "
                              + mySoapHeader1);

            // Remove a SoapHeader from the collection.
            mySoapHeaderCollection.Remove(mySoapHeader1);
            Console.WriteLine("Number of items after removal: {0}",
                              mySoapHeaderCollection.Count);
        }
        else
        {
            Console.WriteLine(
                "mySoapHeaderCollection does not contain mySecondSoapHeader.");
        }
// </Snippet1>

        mySoapHeaders = new MySoapHeader[mySoapHeaderCollection.Count];
        mySoapHeaderCollection.CopyTo(mySoapHeaders, 0);
        object[] results = this.Invoke("Add", new object[] {
            xValue,
            yValue
        });
        return((System.Single)(results[0]));
    }