at compile time the compiler says unable to cast Dictionnary(of string, TSource) into Dictionnary(of string, msg.message)
But In fact Tsource is declared like a message (TSource As Msg.Message) so Why the cast in not possible ? Do I have to write my own converter by creating a new type and implementing the casting by myself ? It is a solution but Why the comiler does not recognize those "related" type ? Sang-Do On 16 sep, 09:00, Samresh <[email protected]> wrote: > A detailed error report would be helpful. > > On Sep 15, 9:06 pm, Sang-Do <[email protected]> wrote: > > > > > Hello, > > > I'm working on an application and somewhere in the code I wrote this > > function : > > > Protected Function AddComputedColumn(Of TSource As Msg.Message) > > (ByVal displayString As String, _ > > ByVal dataMember > > As String, _ > > ByVal > > computeDelegate As ING.Framework.Utils.FunctionDelegate(Of String, > > TSource), _ > > Optional ByVal > > width As Integer = 100) As GridEXColumn > > > Dim result As GridEXColumn = Me.Grid.AddComputedColumn(Of > > TSource)(displayString, dataMember, computeDelegate, width) > > If (mComputedColumns Is Nothing) Then > > mComputedColumns = New Dictionary(Of String, > > ING.Framework.Utils.FunctionDelegate(Of String, > > ING.Framework.Msg.Message)) > > End If > > > mComputedColumns.Add(result.Key, computeDelegate) > > 'The line above givesCOMPILATION ERROR : Value of type > > 'ING.Framework.Utils.FunctionDelegate(Of String, TSource)' cannot be > > converted to 'ING.Framework.Utils.FunctionDelegate(Of String, > > ING.Framework.Msg.Message)' > > > Return result > > > End Function > > > I also have this property : > > Protected mComputedColumns As Dictionary(Of String, > > ING.Framework.Utils.FunctionDelegate(Of String, > > ING.Framework.Msg.Message)) > > > Public ReadOnly Property ComputedColumn() As Dictionary(Of > > String, ING.Framework.Utils.FunctionDelegate(Of String, > > ING.Framework.Msg.Message)) > > Get > > Return mComputedColumns > > End Get > > End Property > > > I can't understand why it is unable to make the conversion since the > > TSource is type ING.Framework.Msg.Message. > > > Is it logic ? or Do I something wrong ?- Masquer le texte des messages > > précédents - > > - Afficher le texte des messages précédents -
