我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DevExpress.AspNetCore.RichEdit;
using DevExpress.AspNetCore;
using DevExpress.Web.Mvc.UI;
using DevExpress.Blazor.RichEdit;
using System.Runtime;
namespace TextEditor.Pages
{
public static RichEditBuilder RichEdit(this BuilderFactory factory,
string name
);
}
我得到这些错误:
错误CS1106
必须在非通用静态类中定义扩展方法错误CS0116
命名空间不能直接包含字段或方法等成员错误CS0501
".RichEdit(BuilderFactory,string("必须声明正文,因为它没有标记为抽象、外部或部分TextEditor
您需要有一个public static class RichEditUtils
,然后它包含您的此方法-您不能在命名空间级别直接拥有该方法。。。
namespace TextEditor.Pages
{
public static class RichEditUtils
{
public static RichEditBuilder RichEdit(this BuilderFactory factory, string name)
{
// do something here that ends up returning a "RichEditBuilder" ...
}
}
}