Click here to Skip to main content
15,899,935 members
Home / Discussions / C#
   

C#

 
GeneralRe: Console app question Pin
James T. Johnson4-Jan-02 11:46
James T. Johnson4-Jan-02 11:46 
GeneralRe: Console app question Pin
Krista Crawley-Archer4-Jan-02 11:50
Krista Crawley-Archer4-Jan-02 11:50 
GeneralRe: Console app question Pin
James T. Johnson4-Jan-02 13:13
James T. Johnson4-Jan-02 13:13 
GeneralRe: Console app question Pin
Valer BOCAN24-Jan-02 21:17
Valer BOCAN24-Jan-02 21:17 
Generalcasting (headaches) Pin
Senkwe Chanda3-Jan-02 0:22
Senkwe Chanda3-Jan-02 0:22 
GeneralRe: casting (headaches) Pin
James T. Johnson3-Jan-02 0:42
James T. Johnson3-Jan-02 0:42 
GeneralRe: casting (headaches) Pin
Senkwe Chanda3-Jan-02 0:53
Senkwe Chanda3-Jan-02 0:53 
GeneralRe: casting (headaches) Pin
James T. Johnson3-Jan-02 1:07
James T. Johnson3-Jan-02 1:07 
GeneralInstr Pin
2-Jan-02 14:04
suss2-Jan-02 14:04 
GeneralRe: Instr Pin
James T. Johnson2-Jan-02 18:14
James T. Johnson2-Jan-02 18:14 
Generalobtaining drive information Pin
hotlemonade2-Jan-02 13:47
hotlemonade2-Jan-02 13:47 
GeneralWin32 APi with C# Pin
kasturirawat31-Dec-01 13:54
kasturirawat31-Dec-01 13:54 
GeneralRe: Win32 APi with C# Pin
James T. Johnson31-Dec-01 19:59
James T. Johnson31-Dec-01 19:59 
GeneralRe: Win32 APi with C# Pin
kasturirawat2-Jan-02 6:39
kasturirawat2-Jan-02 6:39 
GeneralRe: Win32 APi with C# Pin
James T. Johnson2-Jan-02 9:50
James T. Johnson2-Jan-02 9:50 
GeneralTAPI Pin
31-Dec-01 4:27
suss31-Dec-01 4:27 
GeneralAutomating MS Office97/2000/XP with same C# Code Pin
29-Dec-01 1:41
suss29-Dec-01 1:41 
GeneralRe: Automating MS Office97/2000/XP with same C# Code Pin
James T. Johnson30-Dec-01 19:59
James T. Johnson30-Dec-01 19:59 
GeneralRe: Automating MS Office97/2000/XP with same C# Code Pin
Peter Tewkesbury2-Jan-02 5:49
professionalPeter Tewkesbury2-Jan-02 5:49 
GeneralWriting a custom Grid control and need help coding the scrolling events Pin
hsd28-Dec-01 10:01
hsd28-Dec-01 10:01 
GeneralRe: Writing a custom Grid control and need help coding the scrolling events Pin
James T. Johnson30-Dec-01 20:16
James T. Johnson30-Dec-01 20:16 
GeneralRe: Writing a custom Grid control and need help coding the scrolling events Pin
James T. Johnson31-Dec-01 20:02
James T. Johnson31-Dec-01 20:02 
GeneralFunction Pin
26-Dec-01 16:32
suss26-Dec-01 16:32 
GeneralRe: Function Pin
Christian Graus26-Dec-01 16:50
protectorChristian Graus26-Dec-01 16:50 
GeneralRe: Function Pin
Andreas Philipson26-Dec-01 23:18
Andreas Philipson26-Dec-01 23:18 
You could also use the out keyword.
public bool OurFunction (out object value2)
{
   bool value; //return value;

   //do whatever...

   if (value)
      value2 = "This object returned true!!!";
   else
      value2 = new string [] {"This object", "returned", "true", "!!!"};

   return value;
}



Or you could simply just return an object and then check the type wheter it's true of false...
public object OurFunction2 ()
{
   bool value;
   object value2;

   // do whatever...

  if (value)
      value2 = "This object returned true!!!";
   else
      value2 = new string [] {"This object", "returned", "true", "!!!"};

   return value2;
}

public void MainFunction ()
{
   object obj = this.OurFunction2 ();
   if (obj.GetType () == typeof (string)) //true
      Console.WriteLine ("TRUE!!!")
   else // false...
      Console.WriteLine ("FALSE!!!");
}

Smile | :)

Andreas Philipson

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.