© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
81 replies
fateos

❔ Understanding the model-view-controller

if there is a good example with code I would be thankful if you linked it here.

So from what I understand correct me if I am wrong:

I have these classes:
Model: Dog.cs,Person.cs ..
View: form.cs
Controller: logic.cs

right now if I do a winforms app lets say
my view is the events (code in form.cs)
then i do separate class for the model (for example person class dog class and so on)
and the controller class that manages the logic

Do I put the proper method call in the click events in my form.cs?
and the method calls all come from my controller class right?
so in my form.cs I have a click event in that click event I say for example "controller.CreatePerson(name,age..);"
and this controller class has access to the Dog,Person class through composition

There could be also some ifs in my form.cs depending on if I want to do certain logic only if that checkbox is checked for example and so on. But then the logic is not all in my logic.cs

did I get this concept right?

Looking at this Picture on this link: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

the Model updates the view but how would that look in this code example? I thought the models are just the "object classes"
Model–view–controller
Model–view–controller (MVC) is a software design pattern commonly used for developing user interfaces that divides the related program logic into three interconnected elements. This is done to separate internal representations of information from the ways information is presented to and accepted from the user.Traditionally used for desktop graph...
Model–view–controller
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements
Next page

Similar Threads

✅ Model view controller web app + SQL
C#CC# / help
2y ago
✅ Not Quite Understanding Model Usage
C#CC# / help
2y ago
❔ Cannot Find ASP.NET Core Web App ( Model -View-Controller ) in VS
C#CC# / help
3y ago