Programmatic Access to Resources

In addition to creating resources with Visual Studio or the other tools provided, you can create, manage, and use resources easily through code. An example of this application of resources would be to store some custom data for your application (for example, window sizes and positions) to be retrieved when the program was run again.

Reading and writing resources are performed with the ResourceReader and ResourceWriter classes. These objects let you deal with resources stored in streams or in files.

In the example that follows, we have prepared a simple Windows Forms application that displays a red and yellow ball on the form's surface. You can pick these balls up with the mouse and move them about. When the application ...

Get C# and the .NET Framework: The C++ Perspective now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.