Q:

C# creating a method valid only for arrays of my class

Let's say that I have a class foo and another bar. I want to create a method in the foo class to convert a foo array to a bar object (that is not an array), like this:
foo[] v1 = new foo[] { };
bar v2 = v1.ToBar();

How can I do it?

A:

You can use an Extension Method:

Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

All you need is a public static class to hold your extension method. Notice this before first method parameter - that's what makes it an extension method.
public static class FooExtensions
{ 
    public static Bar ToBar(this Foo[] source)
    {
        return new Bar();  // replace with correct logic;
    }
}

