interface Questions

1

In C#, is there a way of using the with keyword on an interface, without knowing the type (or base type) of the object? I'm imagining something like the DoSomething method in the following pseudo-c...
Portcullis asked 15/8, 2021 at 23:58

2

I would like to get the NIC driver 64bit statistics in userspace, in the simplest way possible. The man page of API function getifaddrs(), suggests a simple example program that does it using 32bit...
Phonics asked 26/2, 2018 at 11:30

7

Solved

Do interfaces solve the deadly diamond of death problem? I don't think so, for example: // A class implementing two interfaces Interface1 and Interface2. // Interface1 has int x=10 and Interface2...
Permanganate asked 25/3, 2012 at 14:14

5

Solved

Failing to call shutdown() on a thread executor will result in a never terminating application. Best practice to shut down the ExecutorService is this: ExecutorService service = null; try { ser...
Lens asked 30/12, 2016 at 9:0

4

We have a multi-tenant web application in which a many pages operate per-tenant. As a result many of our interfaces look like this interface ISprocketDeployer { void DeploySprocket(int tenantId);...
Origin asked 3/4, 2014 at 14:34

2

Solved

How to define a static member in an Interface? Why it is not possible? I want to force a F# type (class) to have a static method to create an instance of itself from a string (JSON parsing). I wa...
Negligible asked 18/4, 2020 at 15:24

3

For larger VBA projects (40,000+ lines of code) I cannot properly use interfaces because the Application (I mainly use Excel) will crash quite often. Apparently, this is because the code cannot rem...
Speiss asked 21/9, 2020 at 9:40

3

Solved

I have this interface: public interface FakeTemplate { @CustomAnnotation void foo() { } } And this implementation of the interface: @Component public FakeImpl implements FakeTemplate { ...
Aqueous asked 17/3, 2016 at 15:54

3

This is really bothering me and hindering my development/debugging. Whenever I declare a variable type of the interface I'm implementing, the Locals Window doesn't show it's property values. Instea...
Meeks asked 19/3, 2015 at 13:44

6

Solved

I have following: Assembly asm = Assembly.GetAssembly(this.GetType()); foreach (Type type in asm.GetTypes()) { MyAttribute attr = Attribute.GetCustomAttribute(type, typeof(MyAttribute)) as MyAtt...
Kramatorsk asked 2/12, 2010 at 11:57

3

Solved

Java 9 allows us to have private methods in interface, which means that not explicitly marking public methods is no longer superfluous. However, is it now mandatory to do so? I hope the specificat...
Selfknowledge asked 8/8, 2017 at 17:6

3

Solved

I would like to know regarding following behavior of instanceof operator in Java. interface C {} class B {} public class A { public static void main(String args[]) { B obj = new B(); System.o...
Skepful asked 14/7, 2015 at 5:39

2

Solved

.NET 7 recently introduced IParsable as an interface, and I'd like to check for its presence. Some test that will return true if T implements IParsable<T> and false otherwise. Say I want to r...
Pinnatiped asked 19/11, 2022 at 17:6

8

Solved

I have a class SpecificModifier implements IModifier and there are many very similar class that also implement IModifier. I want every class that implements IModifier to have a public String nameTa...
Pronucleus asked 26/8, 2015 at 0:12

4

Solved

According to this answer, IOptionsMonitor is registered in DI container as singleton and is capable of detecting changes through OnChange event subscription. It has a CurrentValue property. On the ...

8

Solved

I have this interface: public interface IValidationCRUD { public ICRUDValidation IsValid(object obj); private void AddError(ICRUDError error); } But when I use it (Implement Interface, automat...
Loophole asked 5/9, 2009 at 14:24

9

Solved

I need to define an Interface which has to enforce certain operator overloading to the types which implements it. There doesn't seem an obvious way to do it since operator overloading has to be don...
Elysha asked 28/9, 2010 at 9:16

6

Oftentimes when browsing code, I'll come across something like this: public class Fruity { private IOrange _Orange; public Fruity() { _Orange = new Orange() as IOrange; } public void Prepa...
Pleopod asked 5/4, 2013 at 9:43

5

Solved

In TypeScript, I declare an interface like this: export default interface MyDTO { readonly num: string; readonly entitle: string; readonly trb: string; readonly ucr: string; readonly dcr: stri...
Implicate asked 6/7, 2020 at 15:37

4

Solved

Out of curiosity: how does the CLR dispatch virtual method calls to interface members to the correct implementation? I know about the VTable that the CLR maintains for each type with method slots ...
Illassorted asked 21/3, 2012 at 16:39

2

Solved

In the below example, the module outer has a private type Private and a private inner module inner. inner is able to access Private (because child modules can access their parent's private items, e...
Cleveite asked 8/6, 2018 at 5:30

2

Solved

I have a .Net core web application and .net core library. When using Dapper, I need to pass in a concrete class that inherits from IDbConnection. The problem is that in .Net Core System.Data is not...
Redneck asked 30/7, 2017 at 15:34

5

Solved

I just realised that Office 2007 now shows multiple pages per default. I can finally take advantage of that huge monitor I've bought. Is there a similar feature with Visual Studio? Something lik...
Isometry asked 11/11, 2008 at 2:47

2

I want to create an interface like this: interface Show { show(): string; } function doit(s: Show) { return 'Showed: ' + s.show(); } Then we can use it with a new class: class Foo { s: stri...
Stokeontrent asked 26/4, 2014 at 4:15

13

I was learning through interfaces when I noticed that you can now define static and default methods in an interface. public interface interfacesample2 { public static void method() { System.out...
Indomitability asked 8/1, 2015 at 4:51

© 2022 - 2024 — McMap. All rights reserved.