PC Review


Reply
Thread Tools Rate Thread

Generics Problem

 
 
Chris Oswald
Guest
Posts: n/a
 
      28th Jun 2006
I am trying to pass a generic collection as a parameter to a method and
I keep getting a compile error. I can do this in the full framework
but not CF. Can anyone explain to me why this doesn't work? I get the
following error: genasm.exe(1) : error There was an error finalizing
type . Type 'DTC.NAFOP.Mobile.DockClient.Driver,
DTC.NAFOP.Mobile.DockClient, Version=1.0.1.13528, Culture=neutral,
PublicKeyToken=null' was loaded in the ReflectionOnly context but the
AssemblyBuilder was not created as
AssemblyBuilderAccess.ReflectionOnly.

I have attached a code sample below

Public Class Driver()

Sub New()
' Default Ctor
End Sub

private _firstName as string

Public Property FirstName() As String
Get
Return _firstName
End Get
Set(ByVal value As String)
_firstName = value
End Set
End Property

End Class

Public Class Geofence

Sub New()
' Default Ctor
End Sub

Public Sub FenceDrivers(ByVal drivers As
System.Collections.ObjectModel.Collection(Of Driver))
' Fence Drivers
End Sub

End Class

 
Reply With Quote
 
 
 
 
Chris Oswald
Guest
Posts: n/a
 
      28th Jun 2006
I was missing a namespace import to the system.collections.generic.

Chris Oswald wrote:
> I am trying to pass a generic collection as a parameter to a method and
> I keep getting a compile error. I can do this in the full framework
> but not CF. Can anyone explain to me why this doesn't work? I get the
> following error: genasm.exe(1) : error There was an error finalizing
> type . Type 'DTC.NAFOP.Mobile.DockClient.Driver,
> DTC.NAFOP.Mobile.DockClient, Version=1.0.1.13528, Culture=neutral,
> PublicKeyToken=null' was loaded in the ReflectionOnly context but the
> AssemblyBuilder was not created as
> AssemblyBuilderAccess.ReflectionOnly.
>
> I have attached a code sample below
>
> Public Class Driver()
>
> Sub New()
> ' Default Ctor
> End Sub
>
> private _firstName as string
>
> Public Property FirstName() As String
> Get
> Return _firstName
> End Get
> Set(ByVal value As String)
> _firstName = value
> End Set
> End Property
>
> End Class
>
> Public Class Geofence
>
> Sub New()
> ' Default Ctor
> End Sub
>
> Public Sub FenceDrivers(ByVal drivers As
> System.Collections.ObjectModel.Collection(Of Driver))
> ' Fence Drivers
> End Sub
>
> End Class


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in defining a generics m.a Microsoft C# .NET 3 1st Apr 2008 04:45 PM
generics problem =?Utf-8?B?QnJpYW4=?= Microsoft C# .NET 2 26th Oct 2007 09:04 PM
Generics C# VS Generics java VS Template C++ Locia Microsoft C# .NET 2 21st Sep 2005 09:03 PM
Generic Generics Problem 2 Tom Jastrzebski Microsoft C# .NET 3 16th Sep 2005 08:11 AM
Generics - A question on generics - delegates - runtime binding. =?Utf-8?B?YmlndGV4YW4=?= Microsoft C# .NET 10 26th Jul 2005 10:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:33 PM.