[banshee] [Services] Refactoring to avoid hardcoding a type
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Services] Refactoring to avoid hardcoding a type
- Date: Thu, 9 Sep 2010 02:38:57 +0000 (UTC)
commit d3d172db86ef46dd834ea07bac0b38858ae704f2
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Thu Sep 9 04:31:03 2010 +0200
[Services] Refactoring to avoid hardcoding a type
Using Type.IsAssignableFrom() instead of Type.GetInterface(). This
way we ensure that this is always checked by the compiler, so the
error would be caught in case the interface type gets renamed or
its namespace is changed.
Signed-off-by: Alexander Kojevnikov <alexander kojevnikov com>
.../Banshee.ServiceStack/ServiceManager.cs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs b/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
index 9e05bb8..ed06669 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
@@ -352,7 +352,7 @@ namespace Banshee.ServiceStack
lock (self_mutex) {
Type type = typeof (T);
T service = Get (type.Name) as T;
- if (service == null && type.GetInterface ("Banshee.ServiceStack.IRegisterOnDemandService") != null) {
+ if (service == null && typeof(IRegisterOnDemandService).IsAssignableFrom (type)) {
return RegisterService (type) as T;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]