-
-
Save yuka1984/688973eb74fc633f516e5cfbab7181a5 to your computer and use it in GitHub Desktop.
わかんないやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class EntityBase | |
{ | |
public abstract string Name { get; } | |
} | |
public abstract class RepositoryBase<T> where T : EntityBase | |
{ | |
private readonly string _name; | |
public RepositoryBase() | |
{ | |
// ここでTのNameを_nameにセットしたい | |
// こういうケースってクラス名による規則で何かするか、Attributeでなんとかするかしかないのかな? | |
_name = Activator.CreateInstance<T>().Name; | |
} | |
public T Huga() | |
{ | |
// _nameを使った処理をしたい。 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment