c# - 为什么这种扩展方法不起作用?

标签 c# .net extension-methods

public static string ToTrimmedString(this DataRow row, string columnName)
{
    return row[columnName].ToString().Trim();
}

编译正常,但它没有显示在 DataRow 的智能感知中...

最佳答案

我猜你没有包含命名空间。

关于c# - 为什么这种扩展方法不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5411946/

相关文章:

c# - 使用 C# 写入 Excel

.net - dotnet 构建产生 NullReferenceException

c# - 将方法添加到另一个项目的类

c# - 从表达式函数获取属性

c# - 不能对 ContainsGenericParameters 为真的类型或方法执行后期绑定(bind)操作

c# - 继承对象列表

c# - 转换一个实现接口(interface)中所有方法的类

c# - ASP.NET 线程问题

c# - 当前上下文中不存在名称 'ConfigurationManager'

.net - 具有 GUI 和控制台模式的 WPF 应用程序