rksprst
rksprst

Reputation: 6631

Dealing with optional parameters in facebook developers toolkit method... I get an error when using null

I want to do the following:

facebook.Schema.stream_data data = api.stream.get(null, new List<string> { page_id }, null, null, null, null);

But I get the following error:

Error 10 The best overloaded method match for 'facebook.stream.get(int, System.Collections.Generic.List, System.DateTime, System.DateTime, int, string)' has some invalid arguments Error 11 Argument '1': cannot convert from '<null>' to 'int'

Does anybody have any ideas on how to fix this?

Upvotes: 0

Views: 195

Answers (2)

rksprst
rksprst

Reputation: 6631

I ended up solving this problem by upgrading to version 3 of the facebook developers toolkit api. The new version allows me to send null to facebook (which is what facebook expects).

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1502086

Well, you can't convert null to an int - or indeed to a DateTime. You'll need to work out an actual value to pass in - you should be able to look at the API to find out what the default values are, and use those.

Alternatively, if you can use C# 4, you can just name the arguments you do want to pass in, and omit the rest.

Upvotes: 0

Related Questions