Click here to Skip to main content
15,914,452 members
Home / Discussions / C#
   

C#

 
GeneralMy Vote of 5 Pin
Keith Barrow18-Aug-12 10:32
professionalKeith Barrow18-Aug-12 10:32 
GeneralRe: Tuples in Functions Pin
leppie18-Aug-12 21:37
leppie18-Aug-12 21:37 
GeneralRe: Tuples in Functions Pin
BillWoodruff19-Aug-12 14:15
professionalBillWoodruff19-Aug-12 14:15 
GeneralRe: Tuples in Functions Pin
leppie19-Aug-12 19:41
leppie19-Aug-12 19:41 
AnswerLeppie's interesting suggestion to use 'Anonymous Classes' ... Re: Tuples in Functions Pin
BillWoodruff18-Aug-12 15:49
professionalBillWoodruff18-Aug-12 15:49 
GeneralRe: Leppie's interesting suggestion to use 'Anonymous Classes' ... Re: Tuples in Functions Pin
BobJanova20-Aug-12 1:00
BobJanova20-Aug-12 1:00 
QuestionTrying to Obtain Two (2) Values from Function Pin
computerpublic16-Aug-12 21:53
computerpublic16-Aug-12 21:53 
AnswerRe: Trying to Obtain Two (2) Values from Function Pin
DaveyM6916-Aug-12 22:36
professionalDaveyM6916-Aug-12 22:36 
There are a few ways of obtaining multiple values.

1. Create an struct/class that holds more than one value
2. Use an array or list (the same as 1 really)
3. Use an out (or ref if needed) parameter.

1:
C#
public class Pair<T>
{
    private T first;
    private T second;

    public Pair(T first, T second)
    {
        this.first = first;
        this.second = second;
    }

    public T First { get { return first; } }
    public T Second { get { return second; } }
}

C#
public static Double Test(Double Val1, Double Val2, Double Val3)
{
    Double Test_Val = Val1 + Val2 + Val3;
    Double Second_Test = Test_Val % 2;
    return new Pair<Double>(Test_Val, Second_Test);
}


2 should be straight forward.

3:
C#
public static Double Test(Double Val1, Double Val2, Double Val3, out Double secondResult)
{
    Double Test_Val = Val1 + Val2 + Val3;
    secondResult = Test_Val % 2;
    return Test_Val;
}

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: Trying to Obtain Two (2) Values from Function Pin
BobJanova16-Aug-12 22:54
BobJanova16-Aug-12 22:54 
GeneralRe: Trying to Obtain Two (2) Values from Function Pin
Keith Barrow17-Aug-12 2:12
professionalKeith Barrow17-Aug-12 2:12 
AnswerRe: Trying to Obtain Two (2) Values from Function Pin
Sangramsingh Pawar17-Aug-12 0:43
Sangramsingh Pawar17-Aug-12 0:43 
AnswerRe: Trying to Obtain Two (2) Values from Function Pin
V.17-Aug-12 3:16
professionalV.17-Aug-12 3:16 
AnswerRe: Trying to Obtain Two (2) Values from Function Pin
Kuthuparakkal17-Aug-12 16:05
Kuthuparakkal17-Aug-12 16:05 
QuestionHow to insert,update and edit data in datagridview window form Pin
ope4sure116-Aug-12 19:54
ope4sure116-Aug-12 19:54 
AnswerRe: How to insert,update and edit data in datagridview window form Pin
Calla16-Aug-12 20:53
Calla16-Aug-12 20:53 
GeneralRe: How to insert,update and edit data in datagridview window form Pin
Dave Kreskowiak17-Aug-12 3:37
mveDave Kreskowiak17-Aug-12 3:37 
AnswerRe: How to insert,update and edit data in datagridview window form Pin
uspatel17-Aug-12 21:52
professionaluspatel17-Aug-12 21:52 
QuestionIs it possible to read windows password from registry? Pin
Mostafa M.A16-Aug-12 15:09
Mostafa M.A16-Aug-12 15:09 
AnswerRe: Is it possible to read windows password from registry? Pin
Eddy Vluggen16-Aug-12 15:31
professionalEddy Vluggen16-Aug-12 15:31 
GeneralRe: Is it possible to read windows password from registry? Pin
Mostafa M.A16-Aug-12 16:20
Mostafa M.A16-Aug-12 16:20 
AnswerRe: Is it possible to read windows password from registry? Pin
Eddy Vluggen16-Aug-12 16:31
professionalEddy Vluggen16-Aug-12 16:31 
AnswerMessage Closed Pin
16-Aug-12 18:35
Kuthuparakkal16-Aug-12 18:35 
GeneralRe: Is it possible to read windows password from registry? Pin
Eddy Vluggen16-Aug-12 23:35
professionalEddy Vluggen16-Aug-12 23:35 
GeneralMessage Closed Pin
17-Aug-12 2:12
Kuthuparakkal17-Aug-12 2:12 
NewsRe: Is it possible to read windows password from registry? Pin
Eddy Vluggen17-Aug-12 2:49
professionalEddy Vluggen17-Aug-12 2:49 

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.