I have a project with many different auto-generated classes who share many of the same properties. But one of their "shared" properties is declared as an int in some, and a long in others:
public class Book {
int Id { get; set; }
}
public class Movie {
long Id { get; set; }
}
I would like to unite these two classes under a common interface:
public interface Media {
int/long Id;
}
I understand from this question that I can't treat them as the same type, because they aren't.
Based on this question I thought I might declare the field as dynamic in the interface. But this gives me errors because the implementing classes declare the field as int or long, not as dynamic.
The classes are auto-generated from database tables which I do not have the ability to change, so I cannot make the classes all use long or all use int.
Is there an elegant, C-sharpy way to represent both an int and a long in one interface?