interface

Using C++ interface in delphi/pascal

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 05:56:09
问题 I have the following interface defined in a dll: class TestInterface { public: int foo(int)=0; }; And the following functions let's me create objects of this type: extern "C" declspec(dllexport) TestInterface* __stdcall CreateInterface(); The interface is implemented in the dll and I can use it in C++ without any problems (I've also defined the .def file to make sure everything works correctly). However when it comes to using it in pascal I have problems. Here's how I'm trying to use the

How to make a WCF interface utilize variables declared in a service

痴心易碎 提交于 2020-01-03 05:38:06
问题 I recently followed the MSDN tutorial HERE In order to make a service with WCF. My concern now is how to access a variable declared in CalculatorWindowService From CalculatorService so that I can modify it's value for later use in CalculatorWindowService For example if in the methods for Add,Subtract,Divide, and Multiply if I Also wanted the results to be stored into the List<double> DoubleList declared in CalculatorWindowService using System; using System.Collections.Generic; using System

HowTo: Display progress dialog using IFileOperation

会有一股神秘感。 提交于 2020-01-03 01:51:11
问题 I’m trying to get a progress dialog to display for my copy operation in some sample code. I’m using IFileOperation because I found that using SHFileOperation will not display a progress dialog if the files have already been copied to the target location. My hope is that IFileOperation is a little more sophisticated and can handle that situation. Here’s the sample code I’ve tried…. CComPtr<IOperationsProgressDialog> opProgressDlg; HRESULT hr = opProgressDlg.CoCreateInstance(CLSID

C# Logging design: Extension method, alternatives?

和自甴很熟 提交于 2020-01-02 17:44:13
问题 I'd like to write a logger that can be easily appended to any class in my current project. For development, it will be convenient to log messages to the console, whereas in the final release I'd like to log to a file or something. One should be able to change the behavior by editing just a few lines of code, or ideally a settings file. What I have so far is this class structure: public interface ILogger { void LogMessage(String message); // ... other logging functions (exceptions, time etc.)

UI Truncation on Localized Win7 Versions

你。 提交于 2020-01-02 12:25:33
问题 I have a 2 UI developed in C# .NET 3 and Wise Installer respectively. The UI is a Page of Wizard. This works perfectly alright on Win 7 English OS. But when I deploy the app on Win7 Korean or Chinese. I see the truncation. I see the issue even if I hard code the Font as the default font for any localized OS is different. Other Things, I tried were - Changing the Windows Theme, Changing the resolution. But the Issue remains there. I want to understand what could be the reason for such change?

C# Interfaces and Generic Lists

元气小坏坏 提交于 2020-01-02 07:35:31
问题 I have an interface defined as: namespace RivWorks.Interfaces.DataContracts { public interface IProduct { [XmlElement] [DataMember(Name = "ID", Order = 0)] Guid ProductID { get; set; } [XmlElement] [DataMember(Name = "altID", Order = 1)] long alternateProductID { get; set; } [XmlElement] [DataMember(Name = "CompanyId", Order = 2)] Guid CompanyId { get; set; } ... [XmlElement] [DataMember(Name = "buttonPositionCSS", Order = 14)] string buttonPositionCSS { get; set; } } } I have a concrete

Why does a System.Array object have an Add() method?

末鹿安然 提交于 2020-01-02 06:51:12
问题 I fully understand that a System.Array is immutable. Given that, why does it have an Add() method? It does not appear in the output of Get-Member. $a = @('now', 'then') $a.Add('whatever') Yes, I know this fails and I know why it fails. I am not asking for suggestions to use [System.Collections.ArrayList] or [System.Collections.Generic.List[object]] . 回答1: [System.Array] implements [System.Collections.IList], and the latter has an .Add() method. That Array implements IList , which is an

Interface conflict resolution in C#

ε祈祈猫儿з 提交于 2020-01-02 05:25:24
问题 This is a spin-off question based on Eric Lippert's answer on this question. I would like to know why the C# language is designed not being able to detect the correct interface member in the following specific case. I am not looking on feedback whether designing a class this way is considered best practice. class Turtle { } class Giraffe { } class Ark : IEnumerable<Turtle>, IEnumerable<Giraffe> { public IEnumerator<Turtle> GetEnumerator() { yield break; } // explicit interface member

Is it possible to exclude interface classes from AspectJ weaving

拈花ヽ惹草 提交于 2020-01-02 04:38:07
问题 Scenario: I have a mix of source files for classes, interfaces, and enums all together in one package like so: package com.mycompany.data; class Dog { // implementation } package com.mycompany.data; class Cat { // implementation } package com.mycompany.data; enum Gender { // gender options } package com.mycompany.data; interface Animal { // methods } // ... plus a lot more concrete classes and a few more interfaces ... The Goal : To have all of the classes implement a new interface and a new

Creating an abstract class that implements multiple interfaces in c#

荒凉一梦 提交于 2020-01-02 03:37:09
问题 I'd like to create an abstract class in c#, that "inherits" from different interfaces, but leaves the concrete implementation to the subclass. The compiler however complains, that the class doesnt implement the methods specified in the interfaces. I'm used to Java where this always worked, so I'm not sure how it is supposed to work in c#. Anyway, this is my code: public abstract class MyClass : IDisposable, IPartImportsSatisfiedNotification { private string name; public MyClass(string name) {