Click here to Skip to main content
15,921,548 members
Home / Discussions / C#
   

C#

 
GeneralRe: highlighting text in a combo box with the mouse Pin
Heath Stewart26-Jan-04 9:25
protectorHeath Stewart26-Jan-04 9:25 
GeneralRe: highlighting text in a combo box with the mouse Pin
blakeb_126-Jan-04 9:36
blakeb_126-Jan-04 9:36 
GeneralTaking advantage of other langs in .NET Pin
bneacetp26-Jan-04 8:24
bneacetp26-Jan-04 8:24 
GeneralRe: Taking advantage of other langs in .NET Pin
Heath Stewart26-Jan-04 8:57
protectorHeath Stewart26-Jan-04 8:57 
GeneralRe: Taking advantage of other langs in .NET Pin
bneacetp26-Jan-04 9:41
bneacetp26-Jan-04 9:41 
GeneralRe: Taking advantage of other langs in .NET Pin
Guillermo Rivero26-Jan-04 9:47
Guillermo Rivero26-Jan-04 9:47 
GeneralRe: Taking advantage of other langs in .NET Pin
Heath Stewart26-Jan-04 10:17
protectorHeath Stewart26-Jan-04 10:17 
GeneralRe: Taking advantage of other langs in .NET Pin
Guillermo Rivero26-Jan-04 10:49
Guillermo Rivero26-Jan-04 10:49 
QuestionHow to return/store references on objects Pin
Anonymous26-Jan-04 7:42
Anonymous26-Jan-04 7:42 
AnswerRe: How to return/store references on objects Pin
Not Active26-Jan-04 8:52
mentorNot Active26-Jan-04 8:52 
GeneralRe: How to return/store references on objects Pin
Heath Stewart26-Jan-04 8:55
protectorHeath Stewart26-Jan-04 8:55 
GeneralRe: How to return/store references on objects Pin
Not Active26-Jan-04 9:56
mentorNot Active26-Jan-04 9:56 
GeneralRe: How to return/store references on objects Pin
Jörgen Sigvardsson26-Jan-04 10:14
Jörgen Sigvardsson26-Jan-04 10:14 
GeneralRe: How to return/store references on objects Pin
Not Active26-Jan-04 10:18
mentorNot Active26-Jan-04 10:18 
GeneralRe: How to return/store references on objects Pin
Jörgen Sigvardsson26-Jan-04 10:20
Jörgen Sigvardsson26-Jan-04 10:20 
GeneralRe: How to return/store references on objects Pin
Heath Stewart26-Jan-04 10:41
protectorHeath Stewart26-Jan-04 10:41 
For strings, yes, because they are immutable and handled a little differently. I agree that ref and out are handy even in managed code (they are often necessary when P/Invoking native methods, sometimes even with reference types (like for pointer pointers)), but in the case discussed here they are not.

Keep in mind, though, that objects do not require this - only value types and strings (guess I should'be mentioned that too, but at the time I didn't think about it). Take this little example:
using System;
 
public class Test 
{
  public static void Main()
  {
    string s = string.Empty;
    Console.WriteLine(s);
 
    Foo(s);
    Console.WriteLine(s);
 
    Test t = new Test();
    Console.WriteLine(t.s);
 
    Foo(t);
    Console.WriteLine(t.s);
  }
  private static void Foo(string s)
  {
    s = "Testing";
  }
  private static void Foo(Test t)
  {
    t.s = "Testing";
  }
 
  public string s;
 
  public Test()
  {
    s = "This is a test";
  }
}
The output would be:
 
 
This is a test
Testing


 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: How to return/store references on objects Pin
Jörgen Sigvardsson26-Jan-04 12:41
Jörgen Sigvardsson26-Jan-04 12:41 
AnswerRe: How to return/store references on objects Pin
Heath Stewart26-Jan-04 8:53
protectorHeath Stewart26-Jan-04 8:53 
GeneralCEMAPI use in C# :confused: Pin
camasmartin26-Jan-04 7:08
camasmartin26-Jan-04 7:08 
GeneralRe: CEMAPI use in C# :confused: Pin
Heath Stewart26-Jan-04 8:47
protectorHeath Stewart26-Jan-04 8:47 
GeneralReferring to a 2D array through a 1D array Pin
crushinghellhammer26-Jan-04 6:50
crushinghellhammer26-Jan-04 6:50 
GeneralRe: Referring to a 2D array through a 1D array Pin
Anonymous26-Jan-04 8:21
Anonymous26-Jan-04 8:21 
GeneralRe: Referring to a 2D array through a 1D array Pin
crushinghellhammer26-Jan-04 14:25
crushinghellhammer26-Jan-04 14:25 
GeneralRe: Referring to a 2D array through a 1D array Pin
Heath Stewart26-Jan-04 9:06
protectorHeath Stewart26-Jan-04 9:06 
GeneralRe: Referring to a 2D array through a 1D array Pin
crushinghellhammer26-Jan-04 14:37
crushinghellhammer26-Jan-04 14:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.