|
-
Sep 18th, 2003, 04:41 AM
#1
Thread Starter
yay gay
ref & out question
let's see if i got it:
in c# ref types are by default passed by ref and value types are by default passed by out..is this truth?
\m/  \m/
-
Sep 18th, 2003, 07:22 AM
#2
PowerPoster
By default, all parameters in .NET are passed by value (except reference types, which are always passed by ref. Output parameters are always passed by reference and do not need to be initialized before use. The method that is called is responsible for initializing the variable.
-
Sep 18th, 2003, 07:28 AM
#3
Thread Starter
yay gay
hmm i didnt get it
what does "out" do? is it the ByVal equivalent to vb.net?
\m/  \m/
-
Sep 18th, 2003, 10:18 AM
#4
Frenzied Member
When a parameter is passed using out, it does not have to be initialized. You can just declare it and pass it.
Code:
string name;
Hello(out name);
public viod Hello(out string Name)
{
Name = "DevGrp";
}
if out was'nt used you would get a compile error.
Last edited by DevGrp; Sep 18th, 2003 at 10:55 AM.
-
Sep 18th, 2003, 11:16 AM
#5
Thread Starter
yay gay
ahhhhhhh!
and for what is it useful?!
\m/  \m/
-
Sep 18th, 2003, 01:09 PM
#6
PowerPoster
If you want to create a method that returns multiple values
-
Sep 18th, 2003, 01:18 PM
#7
PowerPoster
Lethal, did you get a pm from me? Haven't heard a response, so I wasn't sure.
-
Sep 18th, 2003, 01:27 PM
#8
PowerPoster
No, didn't get it. Let me check.
-
Sep 18th, 2003, 01:32 PM
#9
PowerPoster
It was just about the MCSD exams for .net, and whether you took any of the C# exams yet. If so, what should I hit hard on with my studying?
-
Sep 18th, 2003, 01:35 PM
#10
PowerPoster
I'm going to take the windows exam here in the next few days. If it's anything like the old exams from the VB6 days, I'm gonna spend alittle extra time going over the different types of deployment and the various setup files.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|