Questions tagged as 'interface'

2
answers

How to add static methods in interface?

I have my following method: public static CloudStorageAccount GetAccount() And in my Interface : public interface IAzureStorangeService { CloudStorageAccount GetAccount() } But the compiler accuses that the method was...
asked by 18.11.2014 / 16:31
2
answers

What are functional interfaces?

What are functional interfaces in Java? Has this concept already existed or came out of version 8 of Java?     
asked by 31.03.2014 / 21:02
2
answers

When is it advisable for a class to implement IDisposable?

I use the IOC standard in my project which facilitates the procedure call of type Resolver.Resolve<IPedido>().GerarPedido() , but I did not want to leave it "loose" in this way, I would like to implement the method IDisposable...
asked by 15.11.2015 / 18:27
1
answer

How to get the type of the generic entity of the upper interface?

I have the following situation: public class MinhaClasse : IMinhaClasse<Carro> { //... } public static void Main(string[] args) { var foo = new MinhaClasse(); } Is it possible to get the generic parameter type of IMinhaClasse...
asked by 17.03.2014 / 19:52
2
answers

How do I know if a class implements an interface?

In PHP, we can implement one (or more) interface in a class. So: interface Authenticable { // métodos } interface Model { // métodos } class Person implements Authenticable, Model { // métodos } In...
asked by 21.10.2016 / 12:39
1
answer

When using Interfaces

I always had the following question: When should I really use an interface rather than inheritance and what advantages can I get?     
asked by 08.05.2015 / 06:25
2
answers

Theoretical doubt - Interface, single responsibility

Presentation: I created a class fotografia.cs that should be responsible for: Calculate the angle of view of the lens; Lens zoom (in mm) Receive the cut factor (value multiplied by the zoom of the lens shows the actual lens value)...
asked by 24.03.2014 / 14:52
1
answer

Pros and cons of securing the contract of an interface through a subclass

This article presents a interface IList<T> containing Add(T item) and Count() methods. The interface contract expects that when an item is added, the Count() method reflects the new quantity of items in the li...
asked by 08.07.2016 / 22:16
2
answers

Declaration of an interface with where

I am studying a lot design pattern , as I think they solve a lot and it is very opportune to study them. I got this statement from the Macoratti website and I confess, I could not explain from where . What does that mean? public interfa...
asked by 11.07.2015 / 22:38
2
answers

Better applicability to make a functional interface

From Java 8, in order for an interface to become functional, does it need to have just one method? But we have the @FuncionalInterface annotation, which explicitly defines that this interface is functional. But what is the main difference in...
asked by 30.03.2016 / 06:42