|
Ennis Ray Lynch, Jr. wrote: Objects are always addressed by reference
That doesn't mean that they are passed by reference as parameters.
Ennis Ray Lynch, Jr. wrote: Both of our statements are technically correct as it depends on how you are looking at the problem.
No, your statement doesn't become correct regardless of how you look at it. Objects are simply not passed by reference unless you specify it with the ref keyword.
Ennis Ray Lynch, Jr. wrote: My statement does a lot of help because anyone that reads it at face value will say ... "Wow, I didn't know that I am going to do some more research".
And one of the first thing that they find out is that it is wrong, and say "Wow, what a wild goose chase I was fooled into".
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I think you suffer from a fundamental misunderstanding of pointers and dynamic memory. Spend some time in c and come back to the subject when you are refreshed.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: I think you suffer from a fundamental misunderstanding of pointers and dynamic memory. Spend some time in c and come back to the subject when you are refreshed.
I spent some time in C, as well as several other languages. If you can't see where you are wrong, I am afraid that it's you that lack some crucial understanding of how pointers work. Perhaps you should try some assembly language programming to get a firm grip about how everything works under the hood.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
There is a difference between passing a reference and passing a reference to a reference and I would have thought someone with assembly language experience would have known that.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: There is a difference between passing a reference and passing a reference to a reference and I would have thought someone with assembly language experience would have known that.
I know the difference. If you also truly knew the difference you should not say that object are passed by reference. Or is it that you don't know the meaning of what you said?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hmm, interesting discussion. Maybe you're assuming references to behave like C++ references?
struct S
{
void SayHello() {}
}
void Caller()
{
S *s = new S();
Callee(s);
}
void Callee(S *p)
{
p->SayHello();
}
Will you agree that the instance pointed at by s is passed by reference?
|
|
|
|
|
S. Senthil Kumar wrote: Maybe you're assuming references to behave like C++ references?
Not at all.
S. Senthil Kumar wrote: Will you agree that the instance pointed at by s is passed by reference?
No, it's not a copy of the instance that is passed. It's the value of the variable s that is passed, which happens to be a pointer to the instance.
Was that code supposed to show an example of a C++ reference? Because it isn't.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: No, it's not a copy of the instance that is passed. It's the value of the variable s that is passed, which happens to be a pointer to the instance.
Well, than can you write a snippet of code that demonstrates passing by reference? Because I can't see how *anything* can be passed by reference at all - ultimately, an address would have to pushed on to the stack and popped at the other end.
Guffa wrote: Was that code supposed to show an example of a C++ reference? Because it isn't.
That snippet of code wasn't meant to show C++ references.
|
|
|
|
|
S. Senthil Kumar wrote: Well, than can you write a snippet of code that demonstrates passing by reference?
Well, that's easy:
void GetAnswer(ref string answer) {
answer = "42";
}
string answer = null;
GetAnswer(ref answer);
S. Senthil Kumar wrote: Because I can't see how *anything* can be passed by reference at all - ultimately, an address would have to pushed on to the stack and popped at the other end.
Then you don't understand the concept of passing by reference. Usually a pointer or reference is passed on the stack, but it doesn't have to be implemented that way. The specification only says that the value of the variable will be updated when the control passes back to the calling method, so the value of the variable could actually be passed back and forth instead of a passing a pointer to the variable.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: The specification only says that the value of the variable will be updated when the control passes back to the calling method, so the value of the variable could actually be passed back and forth instead of a passing a pointer to the variable.
I guess you are sticking to the C# spec's ref, which is similar to C++ references in that they "behave" like aliases. Passing by reference is a much more general concept. According to your theory, there's no difference between the following snippets of C++ code.
struct S
{
void SayHello() {}
}
void Caller()
{
S s;
Callee(s);
}
void Callee(S s)
{
s.SayHello();
}
and
struct S
{
void SayHello() {}
}
void Caller()
{
S s;
Callee(&s);
}
void Callee(S* s)
{
s->SayHello();
}
If the second snippet is not pass by reference, as you argued, then what would you call the difference in behavior between the two snippets?
|
|
|
|
|
DaveyM69 wrote: ref has to be preassigned but does not have to be used in the method
Correct.
DaveyM69 wrote: out must be assigned before returning but can be unassigned before calling the method
Correct.
DaveyM69 wrote: Just discovered that if using out, the parameter is treated as if it is unassigned (even if it's already been assigned) as soon as you call the method.
Even if you use a variable that has been assigned a value as an out parameter, that value is not sent to the method. The out parameter is only one way.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I do not know why all of a sudden I can not uninstall my windows service.
I alway un-install as follows:
in visual studio 2008 command prompt:
installutil /u c:\windowsservicefolder\bin\debug\appname.exe
The message is:
The unistall has completed.
An exception occured while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.
Any thoughts please?
Thanks
|
|
|
|
|
You sometimes get this if you have the service manager open.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
No, it is closed.
I even re-started the machine.
Any thoughts?
Thanks
|
|
|
|
|
I think Uninstallation is completed,exception may be cause of some dependency problem. check the Exception detail.
Cheers!!
Brij
|
|
|
|
|
Not sure where to check.
The exception I sent you is what the system gives...
|
|
|
|
|
Even if I create a simple i.e. with nothing to run windows service, I can not install it. It gives the same error.
|
|
|
|
|
arkiboys wrote: Not sure where to check.
You are kidding right? You don't know to check the event log?
led mike
|
|
|
|
|
hi,
All ok now.
I had to check the instal log which indicated issues with login.
Thanks
|
|
|
|
|
hi
i use these codes for reporting
my proc:
create proc Cpost
@nopersoneli int
As
Select p.fname,p.lname,p.NoPersoneli,po.name from personal p
Join postpersonal pp
On p.NoPersoneli=pp.Cpersonal
Join post po
On po.code=pp.vpost
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@NoPersoneli";
paramDiscreteValue.Value = "45";
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(@"C:\Documents and Settings\Administrator\Desktop\VEZARAT\VEZARAT\PostCrystalReport.rpt");
reportDocument.SetDatabaseLogon("", "", "niloofar\\i2", "vezaratekar", false);
crystalReportViewer1.ReportSource = reportDocument;
error:The parameter is incorrect
please help to me
thanks a lot
|
|
|
|
|
Can you tell us which line is associated with the error?
|
|
|
|
|
program run
when form opens i see this error
|
|
|
|
|
Put a breakpoint on the line "ReportDocument reportDocument = new ReportDocument();", and run the program with the debugger (F5).
After it stops on this line, hit F10 to execute one line at a time. (The highlighted line is the line that will be executed when you hit F10.)
Tell us which line produces the error.
|
|
|
|
|
i have error in this line:
paramField.Name = "@NoPersoneli";
thanks a lot
|
|
|
|
|
Does the ParameterField class have a Name member? If it doesn't, that may account for the error message.
|
|
|
|