You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to for you to add an Interface for the Anime item and Manga item so I can treat them as the same item to help with accessing internal propertys.
So instead of doing something like this; public long ID { get { if (AnimeItem!= null) return AnimeItem.MalId; else return MangaItem.MalId; } }
I can reference the ID though a interface (or a series of interfaces) , like this
public interface MalItemInteracter
{
long MalId { get; }
string Title { get; }
string Studios { get; }
string Type { get; }
string Author { get; }
string Genres { get; }
float? Score { get; }
}
MalItemInteracter MII = (AnimeItem or MangaItem) as MalItemInteracter();
public long ID { get { MalItemInteracter.MalId; } }
The text was updated successfully, but these errors were encountered:
I assume that you mean main classes, which you receive from GetAnime() nad GetManga() methods.
The idea is not bad, but I think it would need a little adjustements. The models are a bit different - for example, the Manga model does not contain property Studios, and the Anime model has Author property. Both are also prone to changes due to modification done by MAL and Jikan author. You can make a lot of interfaces with common properties, and the may be incompatible on next REST API update.
What I find justified, is to create interface for items with MalId (IMalEntityWithId?), representing entities which has their own separate page on MAL (so it would be Anime, Manga, Characters, People, Genres, Magazines and Producers; would be also users if the MalId was placed on the profile). I think it would satisfy your needs. I have to update library version on 1st or 2nd January due to changes in REST API endpoint, so I guess it can be enclosed on next release.
The best solution, in fact, would be cloning this repository (or forking and then cloning), adding it to your main project, creating an interface of your need and making Anime and Manga classes implement this interface. You would have complete control over interfaces and common properties.
In new version (1.2) both Manga and Anime (and few other classes) share IMalEntity interface which allow you to reference to items by MalId. Documentation should be updated in the near future.
Is there a way to for you to add an Interface for the Anime item and Manga item so I can treat them as the same item to help with accessing internal propertys.
So instead of doing something like this;
public long ID { get { if (AnimeItem!= null) return AnimeItem.MalId; else return MangaItem.MalId; } }
I can reference the ID though a interface (or a series of interfaces) , like this
The text was updated successfully, but these errors were encountered: