Back to Basics: how to build a FrotMachine

Ever wanted to build a Frotmachine? I guess you would.

But, whatever is a Frotmachine?

A Frotmachine is a place where you can store your Frots.
A Frot is something you did to solve a problem quickly.

Well, let’s just start and create a prototype.
Let’s say that the Frot has a description and a category. So, there would be 2 classes in our program. Frot and Category.

Start Visual Studio (2010 or 2008, you’ll need the .NET Framework 3.5) and create a new Project. Choose Console Application.

Then create a new class and make it look like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FrotMachine
{
    public class Category
    {
        public int CategoryID { get; set; }
        public string CategoryName { get; set; }
    }
    
    public class Frot
    {
        public int FrotID { get; set; }
        public string FrotName { get; set; }
        public Category FrotCategory { get; set; }
        public string FrotDescription { get; set; }
    }
}

That’s very nice, but nothings happens, yet. We should do something with this in the Main method in Program.cs.

So put the following code in the Main method from Program.cs:

Frot f = new Frot
  {
     FrotID = 1,
     FrotDescription = "Runas command",
     FrotCategory = new Category { CategoryName = "Windows" }
  };

   Console.Write("laatst heerlijk gefrot ");
   Console.WriteLine("in de categorie {0} met de {1}",
   f.FrotCategory.CategoryName, f.FrotDescription);

Now, build the program and then press Ctrl+F5 to run it.

This is the result:

laatst heerlijk gefrot in de categorie Windows met de Runas command
Press any key to continue . . .

Next time we’ll add the Frot to a database for retrieval.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: