Why is this extension method not working?
public static string ToTrimmedString(this DataRow row, string columnName)
{
return row[columnName].ToString().Trim();
}
Compiles fine but it doesn't show up in intellisense of the DataRow...
My guess is you haven't included the namespace.
Ensure this method is in a static class
of its own, separate class from the consuming DataRow.
namespace MyProject.Extensions
{
public static class DataRowExtensions
{
//your extension methods
}
}
In your consumer, ensure you're:
using MyProject.Extensions