private static string GetMasterType(Type t)
{
Type ofType = typeof(ViewMaster<>).MakeGenericType(t);
string pattern = "~/Views/{0}.master";
foreach (string path in GetPaths(t))
{
string vp = String.Format(pattern, path);
if (virtualPath.FileExists(vp))
{
Type type = BuildManager.GetCompiledType(vp);
if (ofType.IsAssignableFrom(type))
return vp;
}
}
return null;
}