Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ModuleThreeAssignment
- {
- class Program
- {
- enum Days { Monday, Thursday, Wednesday, Thuesday, Friday, Saturday, Sunday };
- public struct Team
- {
- private string name;
- private int points;
- public int position { get; set; }
- //We create a public Name, where we can set the values by using the private string name
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- //This is an example of conditional set;
- public int Points
- {
- get { return points;}
- set
- {
- if (value < 10)
- {
- points = 10;
- }
- if (value > 10)
- {
- points = value;
- }
- }
- }
- }
- static void Main(string[] args)
- {
- Team team1 = new Team();
- team1.Name = "Marek";
- team1.Points = 9;
- team1.position = 1;
- Console.WriteLine(team1.Points);
- //output: 10
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement