Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddService() [2/4]

virtual void System.ComponentModel.Design.ServiceContainer.AddService ( Type serviceType,
object serviceInstance,
bool promote )
inlinevirtual

Implements System.ComponentModel.Design.IServiceContainer.

Definition at line 60 of file ServiceContainer.cs.

61 {
62 if (promote)
63 {
64 IServiceContainer container = Container;
65 if (container != null)
66 {
68 return;
69 }
70 }
71 if (serviceType == null)
72 {
73 throw new ArgumentNullException("serviceType");
74 }
75 if (serviceInstance == null)
76 {
77 throw new ArgumentNullException("serviceInstance");
78 }
79 if (!(serviceInstance is ServiceCreatorCallback) && !serviceInstance.GetType().IsCOMObject && !serviceType.IsInstanceOfType(serviceInstance))
80 {
82 }
84 {
85 throw new ArgumentException(System.SR.Format(System.SR.ErrorServiceExists, serviceType.FullName), "serviceType");
86 }
88 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ErrorServiceExists
Definition SR.cs:82
static string ErrorInvalidServiceInstance
Definition SR.cs:80
Definition SR.cs:7
void AddService(Type serviceType, object serviceInstance)
delegate? object ServiceCreatorCallback(IServiceContainer container, Type serviceType)

References System.ComponentModel.Design.IServiceContainer.AddService(), System.ComponentModel.Design.ServiceContainer.Container, System.Collections.Generic.Dictionary< TKey, TValue >.ContainsKey(), System.SR.ErrorInvalidServiceInstance, System.SR.ErrorServiceExists, System.SR.Format(), System.ComponentModel.Design.ServiceCreatorCallback(), and System.ComponentModel.Design.ServiceContainer.Services.