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

Passing ref arguements

I have one Interface has one Method namely Showlookup
which has one Ref arguement
Like (ref object ctrl)

I want to pass this as ref Arguement when i call the
method.

I tried ShowLookup(ref this);
It shows an error Like u can not pass this as ref or out
parameter Because it is readonly.
Then i tried
ShowLookup(ref object(this));
Now it Shows an Error Like Ref or out Parameter must have
an lvalue.
Then I tried
object obj=object(this);
ShowLookup(ref obj);

Now it won't show any error.
I don't know wether this one is Right or wrong.

Help me in this regard,

Thanks,
Bala
Nov 15 '05 #1
2 3765
Hi,

You can't use this as ref or out parameter obviously, since this is readonly
reference to current class instance.
You might pass other references though such as your latest example.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"Balamurukan" <ba***********@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I have one Interface has one Method namely Showlookup
which has one Ref arguement
Like (ref object ctrl)

I want to pass this as ref Arguement when i call the
method.

I tried ShowLookup(ref this);
It shows an error Like u can not pass this as ref or out
parameter Because it is readonly.
Then i tried
ShowLookup(ref object(this));
Now it Shows an Error Like Ref or out Parameter must have
an lvalue.
Then I tried
object obj=object(this);
ShowLookup(ref obj);

Now it won't show any error.
I don't know wether this one is Right or wrong.

Help me in this regard,

Thanks,
Bala

Nov 15 '05 #2
Balamurukan <ba***********@hotmail.com> wrote:
I have one Interface has one Method namely Showlookup
which has one Ref arguement
Like (ref object ctrl)

I want to pass this as ref Arguement when i call the
method.

I tried ShowLookup(ref this);
It shows an error Like u can not pass this as ref or out
parameter Because it is readonly.
Then i tried
ShowLookup(ref object(this));
Now it Shows an Error Like Ref or out Parameter must have
an lvalue.
Then I tried
object obj=object(this);
ShowLookup(ref obj);

Now it won't show any error.
I don't know wether this one is Right or wrong.


I think you need to be very clear on what ref arguments really are. See
http://www.pobox.com/~skeet/csharp/parameters.html

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

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

Similar topics

9
by: Randell D. | last post by:
Folks, I have created a function that accepts a dynamic number of arguements and while it works, I'm wondering if I am passing it data in a correct format... I call the function as so ...
18
by: Chris | last post by:
Hi I need to pass the entries in a text file to corresponding tables in a database. Can I pass the entire text file to a stored procedure or can I write a VB.NET procedure to pharse the file and...
9
by: Ook | last post by:
I need a function that swaps arguements. This is my function. It works, after calling swapArgs aa now has 321, and bb has 123. My question - did I do it right? Just because it works doesn't mean I...
3
by: junk | last post by:
Hi, Given the following function:- void foo (char *fmt, ...) { } I know how to use va_start, va_end etc to process the parameters but is there an easy way of passing the parameter list...
8
by: Dawn Minnis | last post by:
Hey guys If I have a program (see codeSnippet1) that I compile to be called test.o Then run it as test.o n n 2 3 4 I want the code to be able to strip out the two characters at the start...
0
by: JeffM | last post by:
If you've seen this before, sorry for the repost, the last post had no replies- and I'm still stuck. Can anyone suggest a way to use a comma delimited text file to supply arguements to a method...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
5
by: bg_ie | last post by:
Hi, I'd like to write a function like printf, which takes a string as its first arguement, but then a variable number of arguements after this, based on the contents of the first arguement. ...
2
by: Nike | last post by:
I have a small question w.r.t usage of default arguements in template.. I shall try to elaborate this with an example.. let's say I have some template function , where EntryType is the input for...
3
by: Andy B | last post by:
I have a web form that has controls to be modified on it. The class that will modify the controls is not contained inside the page code. How would I best pass the controls to the external class?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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.