我用这个URL来获得最近关于特定媒体tag喜欢cats使用Instagram API.该URL是这样的:
https://api.instagram.com/v1/tags/cats/media/recent?access_token=*****
Run Code Online (Sandbox Code Playgroud)
不幸的是,没有数据,我得到了下面warning的pagination:
{"pagination":{"deprecation_warning":"next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"},"meta":{"code":200},"data":[]}
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到min_tag_id或min_tag_id?为什么没有data?
我想IEnumerable按类型分隔变量.我的代码是这样的:
if (type is IEnumerable)
{
var listGenericType = type.GetType().GetGenericTypeDefinition().Name;
listGenericType = listGenericType.Substring(0, listGenericType.IndexOf('`'));
if (listGenericType == "List") {
//do something
}
else if (listGenericType == "HashSet") {
//do something
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用type.GetType().GetGenericTypeDefinition().Name的listGenericType是类似List`1或HashSet`1但我想它喜欢List或HashSet.因此,我曾经Substring处理过这个问题!
无论如何在没有postProcessing string类型的情况下处理这个问题?我的意思是下面的代码:
if (type is IEnumerable)
{
var listGenericType = type.GetType().GetGenericTypeDefinitionWithoutAnyNeedForPostProcessing();
if (listGenericType == "List") {
//do something
}
else if (listGenericType == "HashSet") {
//do something
}
}
Run Code Online (Sandbox Code Playgroud)