I need a intereface so that i get the same structure in several arrays that
i create. I think that i need to use enum in a interface. Abstract classes
don't do the job as i need to inherit from several interfaces.
This doesn't Work.
Any ideas?
using System;
namespace well_test
{
public interface IMeassurement
{
public enum index
{
Timestamp, //= 0;
WellNo, //= 1;
WellTHP, //= 2;
WellTHT, //= 3;
WellBHP, //= 4;
WellBHT, //= 5;
SepPressure, //= 6;
SepTemp, //= 7;
SepOilLev, //= 8;
SepWaterlev, //= 9;
SepGasFlow, //= 10;
SepOilFlow, //= 11;
SepWaterFlow, //= 12;
SepOilDensity, //= 13;
WellChokePos, //= 14;
EntryStatus //= 15;
};
...........
......
Torben 1 16704
You define the enum outside the interface, but compile it in the same
assembly (project). Then you can declare a property member of your
interface as having that enum's type:
// this might not compile as-is but you get the picture
public enum Values
{
One,Two,Three
}
public interface IFace
{
Values { get;set}
}
--
Veuillez m'excuser, mon Français est très pauvre. Cependant, si vous voyez
mauvais C #, c'est mon défaut!
"Torben Madsen" <as*****@privat .dk> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. I need a intereface so that i get the same structure in several arrays
that i create. I think that i need to use enum in a interface. Abstract classes don't do the job as i need to inherit from several interfaces. This doesn't Work. Any ideas?
using System; namespace well_test { public interface IMeassurement { public enum index { Timestamp, //= 0; WellNo, //= 1; WellTHP, //= 2; WellTHT, //= 3; WellBHP, //= 4; WellBHT, //= 5; SepPressure, //= 6; SepTemp, //= 7; SepOilLev, //= 8; SepWaterlev, //= 9; SepGasFlow, //= 10; SepOilFlow, //= 11; SepWaterFlow, //= 12; SepOilDensity, //= 13; WellChokePos, //= 14; EntryStatus //= 15; }; .......... .....
Torben
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: SpaceCowboy |
last post by:
I recently got into a discussion with a co-worker about using enums across a
dll interface. He wanted to use chars instead, argueing that depending on
compiler settings the size of an enum could change and lead to memory
corruption. I didn't see how this was possible. He claims that if a dll
built for a program is built with different compiler settings than the
launcher program, the enum size could change.
The only way I could figure...
|
by: David |
last post by:
hello...
how can i use IActiveDesktop COM interface from shell32.dll?
thanx...
|
by: matthew_glen_evans |
last post by:
Hi there,
Quick one about interfaces in c#. It seems that it is illegal to
declare types within an interface.
I was quite used to doing this in VB.net where the interface can define
a
clients remoting interface and object model.
eg..
|
by: Visual Systems AB \(Martin Arvidsson\) |
last post by:
Hi!
I have created an enum list like this:
enum myEnum : int
{
This = 2,
That,
NewVal = 10,
LastItm
|
by: zheng |
last post by:
I create a OCX program with ATL project, and One parameter in the interface
function is ENUM type, and I has defined the ENUM type in the interface, but
compiled falid with MIDL2001, in the generated IDL file, I find the
generated result is not the same with my think, and What can I do?
The generated IDL is so:
in the interface define file(header file):
_interface IMyInterface:...
{
typedef enum _STATE
| |
by: Cristiano de Pádua Milagres Oliveira |
last post by:
What do I to declare the header of a Property in an Interface, and should this property return a generic Enum?
Example:
public interface IMetric
{
Enum Unit { get;}
}
public class ClassTest : IMetric
|
by: Andrew Bainbridge |
last post by:
Hi,
I'm converting some code over from vb.net to c# and have the following
issue.
In VB you can have enum's within an interface. i.e.
Public Interface Class1
Enum ColorType
Black
Red
|
by: Bob |
last post by:
Hi,
Can someone explain why you can't declare enums in an interface?
The compiler says "interfaces can't declare types"
Ignoring the syntax implications it seems to me that you should be able to
declare that an enum exists. i.e. It is within the 'spirit' of an interface
to state that it exists. The implementing class will provide the members.
e.g. I have a code library that performs a function.
It exposes two interfaces which allow for...
|
by: hufaunder |
last post by:
Imagine you have a charting library that can draw lines, bars,
floating bars, bands, etc.
Lines and bars need only one input. Floating bars and bands need two
inputs. There are two approaches:
1) One enum with all 4 types (bars, band, etc). One chart class that
accepts up to 2 arrays of values. If the user choses a band but there
is only one input array throw an exception. If the user passes two
input arrays with different lengths throw...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |