To assign IEnumerable to a new instance of IEnumerable, you will need ToList method. Here is an example:

IEnumerable instanceOne;
IEnumerable instanceTwo;

List instanceListOne = new List();

instanceListOne.Add("a");
instanceListOne.Add("b");

instanceOne = instanceListOne;
instanceTwo = instanceOne;

instanceListOne.Add("c");

foreach (string instance in instanceTwo)
{
	Console.WriteLine(instance);
}

Console.WriteLine("Press any key");
Console.ReadKey();

instanceTwo = instanceOne.ToList();
instanceListOne.Add("d");

foreach (string instance in instanceTwo)
{
	Console.WriteLine(instance);
}

Console.WriteLine("Press any key");
Console.ReadKey();

Notice first:

instanceListOne.Add("a");
instanceListOne.Add("b");

instanceOne = instanceListOne;
instanceTwo = instanceOne;

Then:

instanceListOne.Add("c");

I added firs "a" and "b" to instanceListOne, I assigned instanceListOne to instanceOne, and then I assigned instanceOne to instanceTwo, after that I added "c" to instanceListOne, then I went through instanceTwo and result is:

 

"c" is displayed also in instanceTwo.

Now to have two separate instances of IEnumerable, we need something like:

instanceTwo = instanceOne.ToList();

After that I did something like:

instanceListOne.Add("d");

Result will be still as in previous picture, "d" is not added to instanceTwo, since now we really have separate instances.

Example download from here.

IComparer example, with numbers first, and empty strings at the end:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace IComparer
{
    class Program
    {
        public class myCaseInsensitiveComparer : IComparer
        {
            public int Compare(string x, string y)
            {
                bool isXnumeric = int.TryParse(x, out var xInt);
                bool isYnumeric = int.TryParse(y, out var yInt);

                if (string.IsNullOrWhiteSpace(x) && string.IsNullOrWhiteSpace(y))
                {
                    return 0;
                }

                if (string.IsNullOrWhiteSpace(x))
                {
                    return 1;
                }

                if (string.IsNullOrWhiteSpace(y))
                {
                    return -1;
                }

                if (isXnumeric && isYnumeric)
                {
                    return xInt.CompareTo(yInt);
                }

                return string.Compare(x, y, StringComparison.OrdinalIgnoreCase);
            }
        }

        static void Main(string[] args)
        {
            string[] words = { "1", "a", "A", "", "b", "", "B", "C", "c", "", "", "3" };
            IOrderedEnumerable sortedWords = words.OrderBy(a => a, new myCaseInsensitiveComparer());

            foreach (var sortedWord in sortedWords)
            {
                Console.WriteLine(sortedWord);
            }

            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
    }
}

Result should be something like:

Source you can download from here.

Little bit about regular expressions.

First one my small example:

using System;
using System.Text.RegularExpressions;

namespace RegularExpressions
{
  class Program
  {
    static void Main(string[] args)
    {
      string pattern = "([a])";
      string myName = "Stanko Milosev";
      Console.WriteLine(Regex.IsMatch(myName, pattern));
      Console.ReadKey();
    }
  }
}

According to Regular Expression Language - Quick Reference, pattern [a] means:

[character_group] Matches any single character in character_group. By default, the match is case-sensitive.

Another example comes from codewars. Task was:

Polycarpus works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.

Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Polycarpus inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.

For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".

Recently, Jonny has heard Polycarpus's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Polycarpus remixed. Help Jonny restore the original song.

Solution:

return Regex.Replace(input, "(WUB)+", " " ).Trim();

Where plus sign means:

Matches the previous element one or more times.

And one more my, from my point of view, easier, example:

    static void Main(string[] args)
    {
      string pattern = "(ta)+";
      string myName = "tata";
      Console.WriteLine(Regex.Replace(myName, pattern, "ma"));
      Console.ReadKey();
    }

Result is "ma" - multiple "ta" is replaced with one ma

First install RabbitMQ server. In my case I installed the one from rabbitmq. If you don't have Erlang, it will direct you to the Erlang page. Download and install Erlang, in my case I downloaded OTP 18.3 Windows 64-bit Binary File.

Then in RabbitMQ command prompt write:

rabbitmqctl.bat status

Result should be something like:

If it is not, try to restart your computer.

Next thing is to setup our management plugin

In RabbitMQ command prompt write:

rabbitmq-plugins enable rabbitmq_management

If you installed your RabbitMQ on local host as I did, then go to:

http://localhost:15672/

Username and password is guest / guest

It can be that plugin is not started immediately and you will have to wait couple of seconds before you see login screen of management plugin.

Download .NET/C# RabbitMQ client library, unzip it.

Now, in visual studio start new console application write code like this:

using System;
using RabbitMQ.Client;
using System.Text;

namespace RabbitMQ
{
  class Program
  {
    static void Main(string[] args)
    {
      var factory = new ConnectionFactory() { HostName = "localhost" };
      using (var connection = factory.CreateConnection())
      {
        using (var channel = connection.CreateModel())
        {
          channel.QueueDeclare(queue: "hello",
                                durable: false,
                                exclusive: false,
                                autoDelete: false,
                                arguments: null);

          string message = "Hello World!";
          var body = Encoding.UTF8.GetBytes(message);

          channel.BasicPublish(exchange: "",
                               routingKey: "hello",
                               basicProperties: null,
                               body: body);
          Console.WriteLine(" [x] Sent {0}", message);
        }
      }
    }
  }
}

In reference list add files:

RabbitMQ.Client.dll

and

RabbitMQ.ServiceModel.dll

Which you previously downloaded and uzip it.

When you execute that code open RabbitMQ management, and you should see something like this:

Click on queues button, click on hello

Scroll down and expand get messages

 Click on Get messages button, and you should see your message