interface

Getting the helpstring attribute applied to C# properties exposed via COM interfaces

风流意气都作罢 提交于 2019-12-18 04:14:33
问题 I'm currently working on a library that's to be exposed to COM for use in a legacy project that's being upgraded. I'm creating interfaces that are to be exposed, and they have properties on them with long, int, etc types. Using the DescriptionAttribute, I can get helpstrings generated in the .tlb for interfaces, classes, and methods, but for some reason it doesn't seem to want to work for properties. Is there anyway to get a helpstring generated in the TLB output for properties ? 回答1: You

Getting the helpstring attribute applied to C# properties exposed via COM interfaces

淺唱寂寞╮ 提交于 2019-12-18 04:14:11
问题 I'm currently working on a library that's to be exposed to COM for use in a legacy project that's being upgraded. I'm creating interfaces that are to be exposed, and they have properties on them with long, int, etc types. Using the DescriptionAttribute, I can get helpstrings generated in the .tlb for interfaces, classes, and methods, but for some reason it doesn't seem to want to work for properties. Is there anyway to get a helpstring generated in the TLB output for properties ? 回答1: You

Why can't a list of an interface type accept instances of an inheriting interface? [duplicate]

∥☆過路亽.° 提交于 2019-12-18 04:10:33
问题 This question already has answers here : Convert List<DerivedClass> to List<BaseClass> (10 answers) Closed 2 years ago . Given the following types: public interface IPrimary{ void doBattle(); } // an ISecondary "is" an IPrimary public interface ISecondary : IPrimary { } // An implementation of ISecondary is also an IPrimary: internal class SecondaryImpl : ISecondary { // Required, since this is an IPrimary public void doBattle(){ } } Why can I not do this? List<IPrimary> list = new List

Why can't a list of an interface type accept instances of an inheriting interface? [duplicate]

大憨熊 提交于 2019-12-18 04:10:02
问题 This question already has answers here : Convert List<DerivedClass> to List<BaseClass> (10 answers) Closed 2 years ago . Given the following types: public interface IPrimary{ void doBattle(); } // an ISecondary "is" an IPrimary public interface ISecondary : IPrimary { } // An implementation of ISecondary is also an IPrimary: internal class SecondaryImpl : ISecondary { // Required, since this is an IPrimary public void doBattle(){ } } Why can I not do this? List<IPrimary> list = new List

Why does Arrays.sort take Object[] rather than Comparable[]?

限于喜欢 提交于 2019-12-18 03:56:29
问题 I was wondering why the sort method of the Arrays class is asking for a parameter of type Object[]. Why the parameter is not of type Comparable[]. If you don't pass a Comparable[] it's generating a ClassCastException. Why ... public static void sort(Object[] a) and not public static void sort(Comparable[] a) ? Thanks 回答1: Because the second form would require a reallocation of the array. Even if you know that your array contains only comparables, you cannot just cast it to Comparable[] if the

Is it possible to use getters/setters in interface definition?

拜拜、爱过 提交于 2019-12-18 03:50:34
问题 At the moment, TypeScript does not allow use get/set methods(accessors) in interfaces. For example: interface I { get name():string; } class C implements I { get name():string { return null; } } furthermore, TypeScript does not allow use Array Function Expression in class methods: for ex.: class C { private _name:string; get name():string => this._name; } Is there any other way I can use a getter and setter on an interface definition? 回答1: You can specify the property on the interface, but

Force a function parameter type in Python?

≡放荡痞女 提交于 2019-12-18 03:33:07
问题 I have a function in a Python class that adds Interfaces to a list. def RegisterAsListener(self, inListener): self.__TransitListeners.append(inListener) This is nice, because a class just needs to inherit from said my Interface, grab this object, and register itself for all updates. class ITransit(): def TransitUpdate(self, data): raise NotImplementedError("You must define this function.") (assuming I made an interface correctly) Since i'm not the only one on this project, I don't want

When a class implements a descendant interface, why doesn't it automatically count as implementing the base interface?

别来无恙 提交于 2019-12-18 03:08:48
问题 What's the reason this won't compile? type IInterfaceA = interface ['{44F93616-0161-4912-9D63-3E8AA140CA0D}'] procedure DoA; end; IInterfaceB = interface(IInterfaceA) ['{80CB6D35-E12F-462A-AAA9-E7C0F6FE0982}'] procedure DoB; end; TImplementsAB = class(TSingletonImplementation, IInterfaceB) procedure DoA; procedure DoB; end; var ImplementsAB: TImplementsAB; InterfaceA: IInterfaceA; InterfaceB: IInterfaceB; begin ImplementsAB := TImplementsAB.Create; InterfaceA := ImplementsAB; >> incompatible

jQuery UI: Drag and clone from original div, but keep clones

大城市里の小女人 提交于 2019-12-18 01:57:35
问题 I have a div, which has jQuery UI Draggable applied. What I want to do, is click and drag that, and create a clone that is kept in the dom and not removed when dropped. Think of a deck of cards, my box element is the deck, and I want to pull cards/divs off that deck and have them laying around my page, but they would be clones of the original div. I just want to make sure that you cannot create another clone of one of the cloned divs. I have used the following, which didn't work like I wanted

jQuery UI: Drag and clone from original div, but keep clones

三世轮回 提交于 2019-12-18 01:53:50
问题 I have a div, which has jQuery UI Draggable applied. What I want to do, is click and drag that, and create a clone that is kept in the dom and not removed when dropped. Think of a deck of cards, my box element is the deck, and I want to pull cards/divs off that deck and have them laying around my page, but they would be clones of the original div. I just want to make sure that you cannot create another clone of one of the cloned divs. I have used the following, which didn't work like I wanted