473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

interface function has structure parameter.

I am new to interfaces. My simple string parameter in & return of string
worked fine.

BUT I need something better -
- accept as input a structure, Where is the structure definition maintained
? how isi it used ?

Is this possible & how ?

using System;
using System.Collections;
namespace simpleInterface
{
public struct controlStruct
{
public string ateInstrumClass;
public Hashtable hashParameters;
}

public interface IclassTestDLL11
{

string HeatControl(controlStruct singleControl);
string ModifyString(string giveInput);
}
}
--
Andrew
Jul 20 '07 #1
2 1273
Andrew,

How you have it is fine. If this is not in a library, then you might
want to consider placing it in a library (structure and interface) if you
intend on sharing it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"andrewcw" <an******@acw.comwrote in message
news:E4**********************************@microsof t.com...
>I am new to interfaces. My simple string parameter in & return of string
worked fine.

BUT I need something better -
- accept as input a structure, Where is the structure definition
maintained
? how isi it used ?

Is this possible & how ?

using System;
using System.Collections;
namespace simpleInterface
{
public struct controlStruct
{
public string ateInstrumClass;
public Hashtable hashParameters;
}

public interface IclassTestDLL11
{

string HeatControl(controlStruct singleControl);
string ModifyString(string giveInput);
}
}
--
Andrew
Jul 20 '07 #2
OK Yes this compiles ok.

I am so relieved ! I must not have renewed my DLL because now I see it..as
type ahead and that also compiles !!

public string HeatControl(simpleInterface.controlStruct singleControl)
{
string retVal ="";

Super ! Thanks
--
Andrew
"Nicholas Paldino [.NET/C# MVP]" wrote:
Andrew,

How you have it is fine. If this is not in a library, then you might
want to consider placing it in a library (structure and interface) if you
intend on sharing it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"andrewcw" <an******@acw.comwrote in message
news:E4**********************************@microsof t.com...
I am new to interfaces. My simple string parameter in & return of string
worked fine.

BUT I need something better -
- accept as input a structure, Where is the structure definition
maintained
? how isi it used ?

Is this possible & how ?

using System;
using System.Collections;
namespace simpleInterface
{
public struct controlStruct
{
public string ateInstrumClass;
public Hashtable hashParameters;
}

public interface IclassTestDLL11
{

string HeatControl(controlStruct singleControl);
string ModifyString(string giveInput);
}
}
--
Andrew
Jul 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: kazack | last post by:
I am a little confused with code I am looking at. My c++ book does not go into passing a structure to a function so I pulled out a c book which does. and I do not understand the prototype verses...
16
by: Vu Pham | last post by:
I think this problem relates to either c or c++ ( but I am not sure which one ) so I post to both of these news group. I am sorry if I did something wrong here. Is there any difference between...
10
by: Lorenzo J. Lucchini | last post by:
Do you see any counter-indication to a token extractor in the following form? typedef int token; token ExtractToken(const char** String, char* Symbol); If it finds a valid token at the start...
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
12
by: masoud bayan | last post by:
I've come across something in Interface implementation that I am not sure is correct behavior in VB.NET (and maybe C#) or not? Consider following example: Public Interface IShape
14
by: Mike Labosh | last post by:
How do you define whether the return value of a function is ByRef or ByVal? I have a utility class that cleans imported records by doing *really heavy* string manipulation in lots of different...
8
by: Gregory | last post by:
I have a question about using STL containers in C++ class public interface. Lets say that I want to return some container from class method or accept class method parameter as some container. For...
5
by: Random | last post by:
How can I use reflection (or some other method) to find the type of an object that has been passed in to my method under an interface definition? I try to use GetType, but that won't work.
15
by: Xah Lee | last post by:
On Java's Interface Xah Lee, 20050223 In Java the language, there's this a keyword “interface”. In a functional language, a function can be specified by its name and parameter specs....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.