Reputation: 37633
I am thinking to create some Extension method for the thing below.
So I plan to see
@item.Roles.ConvertToString(...
I created also the extancion method itself. But It is not appearing in place I need.
@item.Roles. Nothing what I need... :(
Any clue?
P.S.
public static class MyExtensions
{
public static string ConvertToString(this ICollection<IdentityUserRole> identityUserRole)
{
var result = string.Empty;
return result;
}
}
Upvotes: 1
Views: 1166
Reputation: 3088
You'll need to export the namespace of that extension method
@using WhereeverTheNameSpaceIs
Does it show up then?
Upvotes: 2
Reputation: 887225
You need to import the namespace containing your extension method using the @using
directive.
Upvotes: 5
Reputation: 86064
Extension methods aren't usable if you haven't imported the namespace their class is defined in.
Upvotes: 2