Need a method to return both a bool and an int

Can anyone show me an example of a method in C# that returns both a Bool and an INT . I think I need to write a method that returns some sort of <List> object but I'm not sure. Any help or direction provided would be most appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
You can return a Class or a Struct which would hold both your values.  Another option would be to pass a variable as "ref" allowing you to change its value within the method and have the original variable also change.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Here's simple class to use:

function Stuff as BOOLINT
         return new BOOLINT(1,99)
end function

Public Class BOOLINT
DIM _TFValue AS boolean
DIM _NumValue AS integer

Public Property TFValue () AS boolean
Return _TFValue
End Get
Set(ByVal value as boolean)
_TFValue = value
End Set
End Property

Public Property NumValue () AS integer
Return _NumValue
End Get
Set(ByVal value as integer)
_NumValue = value
End Set
End Property

Sub New(ByVal TFValue AS boolean, ByVal NumValue AS integer)
_TFValue = TFValue
_NumValue = NumValue

End Sub
End Class
you can have a function that takes an argument that is identified by 'out' keyword.


private bool MyBoolIntFunction(out int someNumber) {
   someNumber = 5;
   return true;
Naman GoelPrinciple Software engineerCommented:
you can do any thing like above said

private bool Method(out int number)
    bool value=false;
    return value;

or create a structure or class with values

public class BoolInt
public int Integer{get;set;}
public bool Boolean {get;set'}

private BoolInt Method()
    BoolInt boolInt= new BoolInt();
    boolInt.Boolean =false;
    return boolInt;

or something like this:

private KeyValuePair<int, bool>Method()
        return new KeyValuePait<int, bool>(10,false);

jazzcatoneAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.