TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Legion
NA
1
0
Problem with specifying type arguments explicitly when using a delegate
Dec 4 2009 10:40 AM
I get the following compile time error from the code below: Error 1 The type arguments for method 'CompSchemaEngineV2.NullableDataReader.GetNullable<T>(int, CompSchemaEngineV2.NullableDataReader.Conversion<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
I can't figure out whats causing it. I've tried everything I and my friends can think of and I can't get it to work. Suggestions?
public
int
GetInt32(
int
index)
{
return
sqlReader.GetInt32(index);
}
public
Nullable
<
int
> GetNullableInt32(
int
index)
{
return
GetNullable(index, GetInt32); //This line throws the error
}
private
delegate
T
Conversion
<T>(
int
ordinal);
private
Nullable
<T> GetNullable<T>(
int
ordinal,
Conversion
<T> convert)
where
T :
struct
{
Nullable
<T> nullable;
if
(sqlReader.IsDBNull(ordinal))
{
nullable =
null
;
}
else
{
nullable = convert(ordinal);
}
return
nullable;
}
Reply
Answers (
0
)
Creating Application for blackberry mobile using c#.Net
About Assemlilies