问题
This is not a duplicated question. I've already searched on SO but I need a different thing.
Is today a way to access an internal class from Razor View, I know that the assembly must be visible and is it yet.
No properties nor methods declared in an "internal" class are accessible from Views by default. I need a way to override this.
Thanks.
回答1:
In most cases you can change the class from internal to public. You can use the InternalsVisibleTo when that isn't desirable.
In the case of .Designer.cs files that are auto-generated with resource (.resx) files, you can change the "Access Modifier" to "public" by opening the resx file in the "Designer" view:
If all else fails, you should be able to use reflection to get what you need. See the top answer here for details on that
Best of luck!
来源:https://stackoverflow.com/questions/11630919/asp-net-mvc3-access-internal-class-from-razor-view