Click here to Skip to main content
15,891,762 members
Home / Discussions / C#
   

C#

 
AnswerRe: Connecting to MySQL from PC Pin
Dave Kreskowiak30-Jul-09 6:31
mveDave Kreskowiak30-Jul-09 6:31 
GeneralRe: Connecting to MySQL from PC Pin
EliottA30-Jul-09 7:26
EliottA30-Jul-09 7:26 
GeneralRe: Connecting to MySQL from PC Pin
MarkB77730-Jul-09 15:20
MarkB77730-Jul-09 15:20 
QuestionHow to Read CSV file in Readonly mode and Populate dataset? Pin
Tridip Bhattacharjee30-Jul-09 2:08
professionalTridip Bhattacharjee30-Jul-09 2:08 
AnswerRe: How to Read CSV file in Readonly mode and Populate dataset? Pin
Dave Kreskowiak30-Jul-09 6:29
mveDave Kreskowiak30-Jul-09 6:29 
GeneralRe: How to Read CSV file in Readonly mode and Populate dataset? Pin
Tridip Bhattacharjee30-Jul-09 18:35
professionalTridip Bhattacharjee30-Jul-09 18:35 
GeneralRe: How to Read CSV file in Readonly mode and Populate dataset? Pin
Dave Kreskowiak31-Jul-09 13:16
mveDave Kreskowiak31-Jul-09 13:16 
QuestionException use instead of validation Pin
Raybarg30-Jul-09 1:14
professionalRaybarg30-Jul-09 1:14 
Hi again, more questions.

In my project I have this service layer I am using, to simplify it could be like this:
ServiceClient myService = new ServiceClient();
SomeDataType[] result = myService.GetSomeData(...arguments...);
myService.Close();


It's 3rd party layer and lacks proper documentation so I played around with this. With some arguments the result is null. I already have my application use these results in grids and with CurrencyManager and BindingContext. The design is assuming that these results from service methods should never be null (but what if they are).

So I decided to do "helper" class which will contain all those service calls and throw exception if data is not valid instead of checking if the data is valid outside.
ServiceClient myService = new ServiceClient();
SomeDataType[] result;

try
{
    result = myService.GetSomeData();

    if (result == null)
    {
        throw new ArgumentNullException("result", "Service method GetSomeData() returned null.");
    }
}
finally
{
    myService.Close();
}
return result;


Because the service raises no exception in the testing case I had it return null, it just returned null, though it has to be a case of an exception because it never shouldnt. So would this be the "proper" way to make sure I get the exception when I think the underlying layer (service) should have raised it?
QuestionStatic constructor Pin
erfgerfgerger30-Jul-09 1:07
erfgerfgerger30-Jul-09 1:07 
AnswerRe: Static constructor Pin
Ashfield30-Jul-09 1:29
Ashfield30-Jul-09 1:29 
GeneralRe: Static constructor Pin
erfgerfgerger30-Jul-09 1:34
erfgerfgerger30-Jul-09 1:34 
GeneralRe: Static constructor Pin
Luc Pattyn30-Jul-09 2:04
sitebuilderLuc Pattyn30-Jul-09 2:04 
GeneralRe: Static constructor Pin
Ashfield30-Jul-09 8:28
Ashfield30-Jul-09 8:28 
AnswerRe: Static constructor PinPopular
DaveyM6930-Jul-09 1:33
professionalDaveyM6930-Jul-09 1:33 
AnswerRe: Static constructor Pin
Daniel Grunwald30-Jul-09 1:49
Daniel Grunwald30-Jul-09 1:49 
GeneralRe: Static constructor Pin
erfgerfgerger30-Jul-09 2:01
erfgerfgerger30-Jul-09 2:01 
GeneralRe: Static constructor Pin
Daniel Grunwald30-Jul-09 2:04
Daniel Grunwald30-Jul-09 2:04 
GeneralRe: Static constructor Pin
erfgerfgerger30-Jul-09 2:07
erfgerfgerger30-Jul-09 2:07 
GeneralRe: Static constructor Pin
PIEBALDconsult30-Jul-09 4:28
mvePIEBALDconsult30-Jul-09 4:28 
QuestionExtreme right click on the scollbar any event? Pin
spalanivel30-Jul-09 0:14
spalanivel30-Jul-09 0:14 
AnswerRe: Extreme right click on the scollbar any event? Pin
Alan N30-Jul-09 3:15
Alan N30-Jul-09 3:15 
GeneralRe: Extreme right click on the scollbar any event? Pin
spalanivel30-Jul-09 18:52
spalanivel30-Jul-09 18:52 
QuestionChecking file longer than 1 hour Pin
Mninawa29-Jul-09 23:45
Mninawa29-Jul-09 23:45 
AnswerRe: Checking file longer than 1 hour Pin
Moreno Airoldi29-Jul-09 23:52
Moreno Airoldi29-Jul-09 23:52 
AnswerRe: Checking file longer than 1 hour [modified] Pin
Mirko198030-Jul-09 0:04
Mirko198030-Jul-09 0:04 

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.