Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the Access Modifier option actually do in a RESX file?

When modifying a RESX file, I've noticed the "Access Modifier" option in the top toolbar.

enter image description here

There are three different options: public, internal, and no code generation. I'm guessing these determine which applications have access to these resource files, but I'm not exactly sure what the difference between the three options are.

  1. I would assume public resources can be accessed from any project within the solution.

  2. I would assume internal resources can only be accessed by the project in which the resource is defined.

  3. I don't know what no code generation does.

What do the three options actually mean?

like image 509
Kameron Kincade Avatar asked Oct 18 '22 19:10

Kameron Kincade


1 Answers

Your assumptions about 1 and 2 are correct.

Try setting the access modifier of a resource item which is used outside of the project in which it was defined from 'Public' to 'Internal' and then build your project again. You will get compiler errors similar to :

error CS0122: 'Resource' is inaccessible due to its protection level

  1. 'No code generation' means a designer file like 'Resource.Designer.cs' doesn't get created:

enter image description here

like image 57
AndyUK Avatar answered Oct 21 '22 05:10

AndyUK