Gooday everyone.
1) I defined a public structure inside a class file (Films.cs) , like this:
public struct CategoryDetails
{
...
}
The class is NOT put into a namespace, for all that matters.
2) I have an aspx file called Catalog, with a code-behind file.
In the code-behind file, I have this (at the same level as the Page_Load method):
private void PopulateControls()
{
--> here I would like to have visibility to the CategoryDetails structure, which I don't
}
I specify that the Catalog.ascx.cs (code-behind) file has a namespace.
- A. What I tried so far was to place the Films class inside the same
namespace. No luck. - B. As you can see, the structure is public. Thank you for your help.
Much appreciated.
Try
Films.CategoryDetailsinstead. Nested classes/structs need to have their wrapping class prefixed (like a namespace) when accessed. (unless you’re accessing it from within that wrapping class)EDIT:
Just to clarify, from within the
Filmsclass, you no longer need to prefix it. (you still may prefix it if there are ambiguous naming issues):