https://bugzilla.novell.com/show_bug.cgi?id=375966
Summary: Compiler gets confused when passing a generic method to
a delegate
Product: Mono: Compilers
Version: 1.9.0
Platform: i686
OS/Version: openSUSE 10.3
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
QAContact: [email protected]
Found By: ---
This works on MS.NET, Here is the compile error:
[EMAIL PROTECTED]:/data/code/tests> gmcs mono-generics3.cs
mono-generics3.cs(21,38): error CS0123: A method or delegate
`BaseFactory.InitializeDataObject(DataObject, string, int)' parameters do not
match delegate `InitializeHelper<T>.PerformInitializeCallback(in T, string,
int)' parameters
mono-generics3.cs(7,26): (Location of the symbol related to previous error)
mono-generics3.cs(27,20): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
small code example:
using System;
using System.Collections.Generic;
internal class InitializeHelper<T> where T : DataObject, new()
{
public delegate void PerformInitializeCallback(T t, string attr, int
reader);
public InitializeHelper(PerformInitializeCallback perform, string attr)
{
}
}
public abstract class DataObject
{
public DataObject() { }
}
public class MsSqlDataObjectFactory : BaseFactory
{
T[] ExecuteReaderAndGetObjects<T>(int command, string attr) where T :
DataObject, new()
{
InitializeHelper<T> helper = new
InitializeHelper<T>(InitializeDataObject, attr);
return new T[] { };
}
}
public abstract class BaseFactory
{
protected void InitializeDataObject(DataObject ob, string attr, int reader)
{
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs