C# Can I make a namespace accessible everywhere in my dot net web site for code-behind and classes -
i have extension method string want available on every code behind , class in solution. method sitting in particular namespace. i'd everywhere have access namespace without me having include in every class.
i've used "namespaces" tag in web config include on every aspx page, not make accessible on code behind or elsewhere.
so, there similar way include namespace everywhere?
so, there similar way include namespace everywhere?
no, afraid there isn't. if place extension method in of root namespaces in scope child namespaces. example:
namespace foo { public static class extensions { public static void go(this string value) { ... } } }
will in scope inside classes declared in foo.*
namespaces. might put extension method in root namespace has same name project , available everywhere because classes automatically generated in child namespaces (unless change that).
Comments
Post a Comment