Skip to content

Instantly share code, notes, and snippets.

@kolosovpetro
Last active January 7, 2022 23:59
Show Gist options
  • Select an option

  • Save kolosovpetro/e76f1c288b6da674fe4965045a2585f0 to your computer and use it in GitHub Desktop.

Select an option

Save kolosovpetro/e76f1c288b6da674fe4965045a2585f0 to your computer and use it in GitHub Desktop.
using System;
namespace CoinChangeProblem.UI
{
public static class Program
{
public static void Main()
{
var user = new User("initial_name");
user.SetName("test_1");
user.SetName("test_2");
user.SetName("test_3");
user.SetName("test_4");
user.SetName("test_5");
Console.WriteLine(user.Name);
}
}
public struct User
{
public string Name { get; set; }
public User(string name)
{
Name = name;
}
public readonly void SetName(string name)
{
ChangeName(name);
}
private void ChangeName(string newName)
{
Name = newName;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment