// Module included in the following assemblies:
//
// assembly-connecting-applications.adoc

[id='ref-dotnet-example-{context}']
= {ClientAmqpDotNetName} example

You can use the following {ClientAmqpDotNetName} example to connect your application to {ProductName}. This example assumes you have created an address of type `queue` named `myqueue`.

[source,csharp,options="nowrap",subs="+quotes,attributes"]
----
using System;
using Amqp;

namespace Test
{
    public class Program
    {
        public static void Main(string[] args)
        {
            String url = (args.Length > 0) ? args[0] : "amqps://_messaging-route-hostname_:443";
            String address = (args.Length > 1) ? args[1] : "myqueue";

            Connection.DisableServerCertValidation = true;
            Connection connection = new Connection(new Address(url));
            Session session = new Session(connection);
            SenderLink sender = new SenderLink(session, "test-sender", address);

            Message messageSent = new Message("Test Message");
            sender.Send(messageSent);

            ReceiverLink receiver = new ReceiverLink(session, "test-receiver", address);
            Message messageReceived = receiver.Receive(TimeSpan.FromSeconds(2));
            Console.WriteLine(messageReceived.Body);
            receiver.Accept(messageReceived);

            sender.Close();
            receiver.Close();
            session.Close();
            connection.Close();
        }
    }
}
----

