T
TYMON
Выдает такую ошибку. Как исправить?
Error 1 Extension methods must be defined in a non-generic static class C:\Documents and Settings\Admin\Мои документы\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 9 11 ConsoleApplication1
<!--shcode--><pre><code class='csharp'>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static string Reverse(this string s)
{
var arr = s.ToCharArray();
Array.Reverse(arr);
return new string(arr);
}
static void Main()
{
List<string> lst = new List<string> { "ПОЛК", "ДОМ", "КЛОП", "БАР", "РАБ" };
var pairs =
from s1 in lst
from s2 in lst.SkipWhile(s2 => !s1.Equals(s2))
where s1.Equals(s2.Reverse())
select new KeyValuePair<string, string>(s1, s2);
foreach (var e in pairs)
Console.WriteLine(e);
}
}
}[/CODE]
Error 1 Extension methods must be defined in a non-generic static class C:\Documents and Settings\Admin\Мои документы\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 9 11 ConsoleApplication1
<!--shcode--><pre><code class='csharp'>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static string Reverse(this string s)
{
var arr = s.ToCharArray();
Array.Reverse(arr);
return new string(arr);
}
static void Main()
{
List<string> lst = new List<string> { "ПОЛК", "ДОМ", "КЛОП", "БАР", "РАБ" };
var pairs =
from s1 in lst
from s2 in lst.SkipWhile(s2 => !s1.Equals(s2))
where s1.Equals(s2.Reverse())
select new KeyValuePair<string, string>(s1, s2);
foreach (var e in pairs)
Console.WriteLine(e);
}
}
}[/CODE]