Skip to content

Instantly share code, notes, and snippets.

@sunmeat
Created December 29, 2025 21:12
Show Gist options
  • Select an option

  • Save sunmeat/1191a5eda3d09d4848cbdd58d168c15e to your computer and use it in GitHub Desktop.

Select an option

Save sunmeat/1191a5eda3d09d4848cbdd58d168c15e to your computer and use it in GitHub Desktop.
model + localization
using mvc.Resources;
using System.ComponentModel.DataAnnotations;
namespace mvc
{
public class Student
{
public int Id { get; set; }
[Display(ResourceType = typeof(SharedResources), Name = nameof(SharedResources.Name))] // !!!
public string? Name { get; set; }
[Display(ResourceType = typeof(SharedResources), Name = nameof(SharedResources.Surname))]
public string? Surname { get; set; }
[Display(ResourceType = typeof(SharedResources), Name = nameof(SharedResources.Age))]
public int Age { get; set; }
[Display(ResourceType = typeof(SharedResources), Name = nameof(SharedResources.GPA))]
public double GPA { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment