interface-implementation

Stack<T> implements ICollection, but has methods from ICollection<T>

南笙酒味 提交于 2019-12-08 19:44:19
问题 I'm trying to create a custom collection based on Stack<T> . When I look at Stack<T> [from metadata] in visual studio, it shows that Stack<T> implements ICollection , which would require it to implement ICollection 's CopyTo(Array array, index) method, but instead, it is shown as having ICollection<T> 's CopyTo(T[] array, index) method. Can someone explain why this is the case? I'm trying to create a collection that mimics Stack<T> pretty heavily. When I implement ICollection as stack does,

Can I globally set the interface implementation to use?

廉价感情. 提交于 2019-12-08 03:56:53
问题 I have an interface: public interface IHHSDBUtils { void SetupDB(); bool TableExists(string tableName); . . . ...that has multiple implementers: public class SQLiteHHSDBUtils : IHHSDBUtils public class SQCEHHSDBUtils : IHHSDBUtils public class FlatfileHHSDBUtils : IHHSDBUtils public class TestHHSDBUtils : IHHSDBUtils I want to be able to specify which implementer is going to be used from a globally accessible spot, such as: public static class HHSConsts { public static IHHSDBUtils hhsdbutil =

in MVC4 shows and error that I have to implement some Interface but I am already done it

﹥>﹥吖頭↗ 提交于 2019-12-06 21:21:34
问题 I am trying to create own filter attribute in order to support multilinguality. The idea is simple. URL stands for language. *http://host.ext/ en /rest_of_the_url* will open in English and *http://host.ext/ hy /rest_of_the_url* will open in Armenian. The problem is that at run it says that MultilingualActionFilterAttribute Here is the error text "The given filter instance must implement one or more of the following filter interfaces: IAuthorizationFilter, IActionFilter, IResultFilter,

Error that I must implement a function in a class even though function is defined [duplicate]

三世轮回 提交于 2019-12-05 09:41:27
This question already has answers here : Class 'QueryParameterComparer' must implement Function Compare. (2 answers) Closed 4 years ago . I get the error: Class 'QueryParameterComparer' must implement 'Function Compare(x As QueryParameter, y As QueryParameter) As Integer' for interface 'System.Collections.Generic.IComparer(Of QueryParameter)'. On this class definition: Protected Class QueryParameterComparer Implements IComparer(Of QueryParameter) Public Function Compare(x As QueryParameter, y As QueryParameter) As Integer If x.Name = y.Name Then Return String.Compare(x.Value, y.Value) Else

How to access abstract superclass implementation when it contains a factory method?

狂风中的少年 提交于 2019-12-04 17:03:35
I have an abstract superclass with a factory that returns an instance of a subclass. Is it possible to have a method that is implemented only in superclass? In the following code, for instance, would it be possible to remove Wind::act()? abstract class Element { final String action; // what it does String act() => action; // do it factory Element() { return new Wind(); } } class Wind implements Element { final action = "blows"; act() => action; // Why is this necessary? } void main() { print(new Element().act()); } When removing Wind::act(), there is an error about it missing. Also, when

Why does this implementer method not see its sibling? [closed]

試著忘記壹切 提交于 2019-12-03 01:13:56
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I've got a class that implements an interface: public class SQLiteHHSDBUtils : IHHSDBUtils { void IHHSDBUtils.SetupDB() { . . . if (!TableExists("AppSettings")) . . . bool IHHSDBUtils.TableExists(string tableName) { . . . It can't find its own brother sitting right below it (the if (!TableExists()

Avoid explicit type casting when overriding inherited methods

橙三吉。 提交于 2019-12-01 15:24:14
I have a base abstract class that also implements a particular interface. public interface IMovable<TEntity, T> where TEntity: class where T: struct { TEntity Move(IMover<T> moverProvider); } public abstract class Animal : IMovable<Animal, int> { ... public virtual Animal Move(IMover<int> moverProvider) { // performs movement using provided mover } } Then I have inherited classes some of which have to override interface implementation methods of the base class. public class Snake : Animal { ... public override Animal Move(IMover<int> moverProvider) { // perform different movement } } My

Finding objects that implement interface from loaded assembly -how to compare types?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 16:04:39
问题 I have class that will load all assemblies in a directory and then get all the types an see if they implement an interface. I cannot get the type comparison to work. In the debugger I see my type loaded (the one I am interested in) if always fails the comparison. If I use the same comparison code locally there is no problem I get the expected result. I could just do sting compares on the type interfaces, but I'd prefer to know what I am doing wrong. Tests: // Fails [Fact] public void

Can a class extend the Collection object?

坚强是说给别人听的谎言 提交于 2019-11-30 09:05:14
I'm trying to extend functionality of the VBA Collection object in a new class and make this class an inheritant of Collection , but the Implements Collection statement gives me the following error: Bad interface for Implements: method has underscore in its name. What underscore?! Add , Item , Remove , and Count are the only methods listed in the documentation for Collection . All four are underscore-free. EDIT : To clarify, I'm making a class called UniformCollection (that only accepts members that are all of the same type, inspired by this approach ). I'd like it to implement Collection , so

Can a class extend the Collection object?

ε祈祈猫儿з 提交于 2019-11-29 13:54:32
问题 I'm trying to extend functionality of the VBA Collection object in a new class and make this class an inheritant of Collection , but the Implements Collection statement gives me the following error: Bad interface for Implements: method has underscore in its name. What underscore?! Add , Item , Remove , and Count are the only methods listed in the documentation for Collection . All four are underscore-free. EDIT : To clarify, I'm making a class called UniformCollection (that only accepts