Does Anyone On Here Know C# And Use Mono?

blackneos940

Active Member
Joined
May 16, 2017
Messages
347
Reaction score
207
Credits
332
Hey guys!..... :3 I had a cool dream about this local town that resided at the end of a pretty long uphill street, and because of the elevation, it was cooler, despite being here in the South..... :3 Anywho, I study C# (and C, and C++, and Python, and..... :)) So I was wondering, do any of you study C#.....? :) I'm still trying to get a grasp on Classes, especially in C#..... :3 I like C# because of it's verbosity, and perhaps because of my Autism (we like detailed, verbose things quite a lot I believe :))..... :3 Well, thanks for any response guys..... Here's the Code from my medication management Program, called Pill_Popper..... What a name, eh.....? ^^ Anywho, it's GPL, so feel free to share it and make any changes (that's why I'm here, actually :D)..... :)

Code:
using System;

using System.IO;

using System.Threading;

namespace Pill_Prompt

{
  public class Pill_Popper_Prompt

  {
    string list_of_meds = Console.ReadLine();

    Thread.Sleep(2000);

    int number_of_meds = Console.ReadLine();

    Thread.Sleep(2000);

    string med_schedule = Console.ReadLine();

    File.WriteAllText("List Of Meds.txt", list_of_meds);

    File.WriteAllText("Med Amount", number_of_meds);

    File.WriteAllText("Med Schedule.txt", med_schedule);

  }

}

namespace Pill_Popper_Main

{
  public class Pill_Popper

  {
    static void Main()

    {


    }

  }

}
 


I haven't done any C# for over 12 years now, but in C# classes are structured like this:

C#:
// Using statements to import classes
using System;
using System.IO;
using System.Threading

// namespace
namespace PillPrompt
{     
    // class definition
    public class PillPopperPrompt
    {
        // private data members
        private String listOfMeds_;
        private int numberOfMeds_;
        private String medSchedule_;
      
        // public constructor
        public PillPopperPrompt()
        {
            // Member initialisation goes here
            // So put any code to get/set initial/default values here
        }

        // Public accessor for number_of_meds
        public int GetNumberOfMeds()
        {
            return numberOfMeds_;
        }
      
        // Rest of accessors go here
        // etc.
        // likewise any public setters/mutators for class members
    }
} // end namespace PillPrompt

namespace PillPopperMain
{
    public class PillPopper
    {
        static void Main()
        {

        } 
    }
}

Normally classes, namespaces and member functions are UpperCamelCase, data members and variables in general code are lowerCamelCase, but there are some people who prefer lower_case_with_underscores for data members and general variables.

Personally, with variables - I use lowerCamelCaseWithTrailingUnderscore_ for data members and lowerCamelCase for local variables.

So if I was writing your code - above is how I would write it.

Also, looking at the above - if your listOfMeds_ member variable is supposed to be holding a list of medications, it would probably be better to store them in a collection of strings, rather than in a single string. So perhaps an ArrayList of Strings?

This would also make the numberOfMeds_ member variable obsolete, because if listOfMeds_ was a collection of strings, your GetNumberOfMeds accessor could simply return listOfMeds_.Count - so you wouldn't need to maintain a separate count of the number of meds. The collection of meds would keep track of the number of meds for you.

Likewise - your medSchedule_ might also need to be a collection of strings too.

Anyway - I won't meddle any more - I'll leave it up to you to decide how you're going to implement the functionality for your classes.
 
Last edited:
I haven't done any C# for over 12 years now, but in C# classes are structured like this:

C#:
// Using statements to import classes
using System;
using System.IO;
using System.Threading

// namespace
namespace PillPrompt
{     
    // class definition
    public class PillPopperPrompt
    {
        // private data members
        private String listOfMeds_;
        private int numberOfMeds_;
        private String medSchedule_;
      
        // public constructor
        public PillPopperPrompt()
        {
            // Member initialisation goes here
            // So put any code to get/set initial/default values here
        }

        // Public accessor for list_of_meds
        public int GetNumberOfMeds()
        {
            return numberOfMeds_;
        }
      
        // Rest of accessors go here
        // etc.
        // likewise any public setters/mutators for class members
    }
} // end namespace PillPrompt

namespace PillPopperMain
{
    public class PillPopper
    {
        static void Main()
        {

        } 
    }
}

Normally classes, namespaces and member functions are UpperCamelCase, data members and variables in general code are lowerCamelCase, but there are some people who prefer lower_case_with_underscores for data members and general variables.

Personally, with variables - I use lowerCamelCaseWithTrailingUnderscore_ for data members and lowerCamelCase for local variables.

So if I was writing your code - above is how I would write it.

Also, looking at the above - if your listOfMeds_ member variable is supposed to be holding a list of medications, it would probably be better to store them in a collection of strings, rather than in a single string. So perhaps an ArrayList of Strings?

This would also make the numberOfMeds_ member variable obsolete, because if listOfMeds_ was a collection of strings, your GetNumberOfMeds accessor could simply return listOfMeds_.Count - so you wouldn't need to maintain a separate count of the number of meds. The collection of meds would keep track of the number of meds for you.

Likewise - your medSchedule_ might also need to be a collection of strings too.

Anyway - I won't meddle any more - I'll leave it up to you to decide how you're going to implement the functionality for your classes.
Thanks, bud!..... :3 I really appreciate it!..... :3 Yeah, I also figured that since C# uses Classes, someone on here might know what I was talking about..... :3 Anywho, I'll copy the Code, and study it thoroughly, so I know what's going on..... ;) Again, thank you!..... :3
 

Members online


Top