Changeset 7492
- Timestamp:
- 02/20/12 17:07:13 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs
r7259 r7492 126 126 var assemblyTypes = assembly.GetTypes(); 127 127 128 var buildTypes = from t in assembly Types128 var buildTypes = from t in assembly.GetTypes() 129 129 where !IsNonDiscoverableType(t) 130 where onlyInstantiable == false || 131 (!t.IsAbstract && !t.IsInterface && !t.HasElementType) 130 132 where CheckTypeCompatibility(type, t) 131 where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)132 133 select BuildType(t, type); 133 134 … … 152 153 return true; 153 154 if (type.IsGenericType && other.IsGenericType) { 155 var otherGenericArguments = other.GetGenericArguments(); 156 var typeGenericArguments = type.GetGenericArguments(); 157 158 //check type arguments count 159 if (otherGenericArguments.Length != typeGenericArguments.Length) 160 return false; 161 162 //check type arguments & constraints 163 int i = 0; 164 foreach (var genericArgument in typeGenericArguments) { 165 if (otherGenericArguments[i].IsGenericParameter) { 166 foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints()) 167 if (!constraint.IsAssignableFrom(genericArgument)) return false; 168 } else if (genericArgument != otherGenericArguments[i]) return false; 169 i++; 170 } 171 //check types 154 172 try { 155 if (type.IsAssignableFrom(other.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArguments()))) 173 var otherGenericTypeDefinition = other.GetGenericTypeDefinition(); 174 if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments))) 156 175 return true; 157 176 } -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs
r7259 r7492 267 267 var buildTypes = from t in assembly.GetTypes() 268 268 where !IsNonDiscoverableType(t) 269 where CheckTypeCompatibility(type, t)270 269 where onlyInstantiable == false || 271 270 (!t.IsAbstract && !t.IsInterface && !t.HasElementType) 271 where CheckTypeCompatibility(type, t) 272 272 select BuildType(t, type); 273 273 … … 286 286 return true; 287 287 if (type.IsGenericType && other.IsGenericType) { 288 var otherGenericArguments = other.GetGenericArguments(); 289 var typeGenericArguments = type.GetGenericArguments(); 290 291 //check type arguments count 292 if (otherGenericArguments.Length != typeGenericArguments.Length) 293 return false; 294 295 //check type arguments & constraints 296 int i = 0; 297 foreach (var genericArgument in typeGenericArguments) { 298 if (otherGenericArguments[i].IsGenericParameter) { 299 foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints()) 300 if (!constraint.IsAssignableFrom(genericArgument)) return false; 301 } else if (genericArgument != otherGenericArguments[i]) return false; 302 i++; 303 } 304 //check types 288 305 try { 289 if (type.IsAssignableFrom(other.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArguments()))) 306 var otherGenericTypeDefinition = other.GetGenericTypeDefinition(); 307 if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments))) 290 308 return true; 291 309 }
Note: See TracChangeset
for help on using the changeset viewer.