public void TestNullIReadOnlyList() { Assert.Pass(); var my = new My01(); my.F(); IMy im = my; im.F(); var m = new My02(); //m.f(); IMy i01 = (IMy)m; i01.F(); IYou i02 = (IYou)m; i02.F(); Environment.Exit(0); int?[] data = { 1, null, 18, 22, 255 }; var result = data.OfType <int>(); foreach (var r in result) { Console.WriteLine(r); } }
public static void Test() { IMy <Derived, Base> @base = null; IMy <Base, Derived> derived = null; @base = derived;//OK //derived = @base;//Cannot implicitly convert type... }
public ApiClient(IMy myService, IThis thisService, IUsersDirectory usersService, ICompaniesDirectory companiesService, IServicesDirectory servicesApi, IDataContainerService dataContainerService, IServiceProvider serviceLocator) { _myService = myService; _thisService = thisService; _usersService = usersService; _companiesService = companiesService; _servicesApi = servicesApi; _serviceLocator = serviceLocator; Directory = new Directory(_usersService, _companiesService, _servicesApi, dataContainerService, _serviceLocator); }
public void AssociateTypeHandlerTest() { TypeAccessor.AssociatedTypeHandler += delegate(Type parent) { if (parent == typeof(IMy)) { return(typeof(MyImpl)); } return(null); }; IMy i = TypeAccessor <IMy> .CreateInstance(); i.Name = "John"; Assert.AreEqual("John", i.Name); Assert.AreEqual("John", TypeAccessor <IMy> .Instance["Name"].GetValue(i).ToString()); }
public Controller(IMy _my) { my = _my; }
public PolicyValidation(IMy myService) { _myService = myService; }
public PolicyValidation(IMy myService, ILogger logger) { _myService = myService; _logger = logger; }
int GetFoo(this IMy my, string name) { return(my.GetFoo(name, DefaultFoo, DefaultBar)); }
public HomeController(ILogger <HomeController> logger, IMy myService, IWtfClient testClient) { _logger = logger; _myService = myService; _testClient = testClient; }
// DI ctor public MyController(IMy my) { _my = my; }
public TestController(IMy myService) { _myService = myService; }