?
Solved

Checking the values passed into a method?

Posted on 2007-10-10
3
Medium Priority
?
143 Views
Last Modified: 2011-09-20
I am passing around 10 values into a method and I was wondering is there a built in way to ensure that all 10 values have been passed in / not null?

I am looking to avoid having a massive if statement or block of statements.

0
Comment
Question by:directxBOB
3 Comments
 
LVL 7

Expert Comment

by:bungHoc
ID: 20048359
Use array or list, then loop through it and check?
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 2000 total points
ID: 20048386
Are all of the types nullable? (strings, objects, or nullable value types like "int?")

You could do some slick thing like putting all of the values into an array and looking for null within the array, but you're going to have to add all of the values so it won't buy you much.

You could create a parameter class to hold the the values and check for null values within the class.
0
 

Author Comment

by:directxBOB
ID: 20048421
Bit the bullet and made my own class with the values.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question