473,396 Members | 1,666 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,396 software developers and data experts.

out object parameter

I have a COM server that's generally working ok. But one of its methods,
when the IDL gets read by the Intertop layer, has parameters of type "out
object".

The C# compiler tells me that it can't convert from object to out object, or
from int* to out object, or from object[] to out object. In fact, I can't
find anything at all that it will accept as a parameter on the call.

I don't think this is a COM issue, because if I wrote my own C# method with
an "out object" parameter I'd have the same problem.

So what does it want to have passed in?

Mike Carroll
Sigma Data Systems
Nov 15 '05 #1
5 8356
Could you provide a snippet of code you use in the C# client?

José
"Mike Carroll" <mc******@gosigma.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have a COM server that's generally working ok. But one of its methods,
when the IDL gets read by the Intertop layer, has parameters of type "out
object".

The C# compiler tells me that it can't convert from object to out object, or from int* to out object, or from object[] to out object. In fact, I can't
find anything at all that it will accept as a parameter on the call.

I don't think this is a COM issue, because if I wrote my own C# method with an "out object" parameter I'd have the same problem.

So what does it want to have passed in?

Mike Carroll
Sigma Data Systems

Nov 15 '05 #2
C# client code, attempting to call methods on DisplayableFieldsLister COM
object:

unsafe private void buttonListMasters_Click(object sender, System.EventArgs
e)
{
AmsDataModule.DisplayableFieldsLister lister = new
DisplayableFieldsLister();
lister.ShowMessage("Hi there!"); // testing COM client; this works

int* tableNames;
object actualFieldNames;
object[] siteFieldNames;
void* fieldDataTypes;
lister.GetDisplayableFields("ListMasters", true, true, true,
tableNames, actualFieldNames, siteFieldNames, fieldDataTypes);
}

Compiler messages:
[C# Error] JobPostingsEditorForm.cs(1032): Argument '5': cannot convert from
'int*' to 'out object'
[C# Error] JobPostingsEditorForm.cs(1032): Argument '6': cannot convert from
'object' to 'out object'
[C# Error] JobPostingsEditorForm.cs(1032): Argument '7': cannot convert from
'object[]' to 'out object'
[C# Error] JobPostingsEditorForm.cs(1032): Argument '8': cannot convert from
'void*' to 'out object'

Preceded by the message:
[C# Error] JobPostingsEditorForm.cs(1031): The best overloaded method match
for 'AmsDataModule.IDisplayableFieldsLister.GetDisplay ableFields(string,
bool, bool, bool, out object, out object, out object, out object)' has some
invalid arguments
Nov 15 '05 #3
Mike,
So what does it want to have passed in?


If you have a method such as

void Foo(out object o)

you call it with

object x;
Foo( out x );

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #4
Ok, so "out" is supposed to be sprinkled in among the parameters being
passed. Don't think I've seen that in any other language.

object tableNames;
object actualFieldNames;
object siteFieldNames;
object fieldDataTypes;
lister.GetDisplayableFields("ListMasters", true, true, true,
out tableNames, out actualFieldNames, out siteFieldNames, out
fieldDataTypes);
Nov 15 '05 #5
Mike Carroll <mc******@gosigma.com> wrote:
Ok, so "out" is supposed to be sprinkled in among the parameters being
passed. Don't think I've seen that in any other language.


That doesn't mean it's a bad thing - on the contrary, it's been added
to make the language clearer. In C#, it's always obvious if you're
passing something as a "ref" or "out" parameter, because it's in the
calling code as well as the method declaration. This is a very good
thing for readability, IMO.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #6

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

Similar topics

4
by: Murat Tasan | last post by:
i have a quick question... is there a way to obtain the reference to the object which called the currently executing method? here is the scenario, i have a class and a field which i would like to...
2
by: Siegfried Weiss | last post by:
Hi guys, i give up finding a solution by reading or by trial & error. Hope, YOU can help me! (Sorry for my rather long posting.) Stroustrup says, that templates could be declared with - type...
14
by: stic | last post by:
Hi, I'm in a middle of writing something like 'exception handler wraper' for a set of different methodes. The case is that I have ca. 40 methods form web servicem, with different return values...
5
by: Ram | last post by:
Hi Friends I want to develope a custom control in .net which can be used with any project. I am writing a function in that class which I want to take any object as parameter. For that I have...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
12
by: Belebele | last post by:
Suppose that a class A depends on class B because an object of class B is passed into A's constructor. See below: class B { ... }; class A { public: A(B const& b); ... };
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
14
by: Philipp Reif | last post by:
Hi all, I've got a little hole in my head concerning references. Here's what I'm trying to do: I'm calling a function, passing the reference of a business object for editing. The function clones...
7
by: Steve | last post by:
I am building an object library for tables in a database. What is the best practice for creating objects like this? For example, say I have the following tables in my database: User: - Id -...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...

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.