Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8497167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:03:17+00:00 2026-06-11T00:03:17+00:00

The c# project I’ve been using to teach myself to code has so far

  • 0

The c# project I’ve been using to teach myself to code has so far been one gigantic form containing tons of functions and a huge amount of “global” static variables.

After reading here, doing some tutorials etc, I’m now trying to go through the process of refactoring it to properly use classes and encapsulation.

My classes:

  • Program.cs – Basically does nothing but initialize Form1.
  • Form1.cs = Generates and modifies all the UI. Calls public functions in the other classes, and has some public functions other classes can call to update it.
  • UiStrings.cs = Contains all the error messages, dialogs, instructions etc.
  • Options.cs = Tracks some settings, builds and updates paths to install files, executes code based on changing UI.
  • Updater.cs = Tracks current version, downloads assets, puts them in the right place, and adjusts the options.
  • Installer.cs = Handles installing/uninstalling/backing up all the assets, based on the current options.

Initially, I created an instance of each of my other classes in Form1. This worked for Form1 to be able to access functions and properties in UiStrings or Options. However those classes couldn’t access parts of each other, presumably because they hadn’t been instantiated.

What this has led me toward is making all my custom classes like UiStrings and Options static (since I don’t need multiple instances of any of them). This also means I have to make every function and property inside each of those classes static too.

Is this a reasonable solution that someone who actually knows what they’re doing would come to?

It seems to work in my testing so far, but my original attempt with no classes at all worked just fine too until I learned how wrong it was.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:03:19+00:00Added an answer on June 11, 2026 at 12:03 am

    if you open project properties (right click on project in Solution explorer, right click, select Properties), you will find Resources tab that is what your UiStrings is for, and Settings tab which is what your Options is for. I would recommend using them as a standard feature. This also eliminates need to design your own feature classes.

    Other than that you could do them static, and you dont have to create a copy of a class to access static members. Syntax is ClassName.Method() or ClassName.Property instead of var instance = new ClassName(); instance.Method();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My project has two cpp files and one header file. One cpp file contains
The project currently has a UIviewController called Dashboard that acts as the main view
This project is in Obj-C for iphone. I'm using the double float version of
Project A contains a WPF Window (Data Entry Form) with a stack panel of
Project Euler has a paging file problem (though it's disguised in other words). I
Project : ASP.NET 3.5 Server : SQL Server 2008 One of the page in
Project is C#. So I have a bunch of multithreaded code that is designed
My project has the following scenario: [Preview View Controller] --(Modal)--> Navigation Controller --(Top)--> [Photo
Our project's template html has a quirks declaration,which is <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML
Project Lombok makes it trivial to implement the boilerplate code in the classes. Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.