473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Passing a generic type of class ?

What is wrong with this type of generic...

I get this error....

Error 1 Inconsistent accessibility: parameter type
'System.Collections.Generic.Queue<TMQ.TheRec>' is less accessible than
method 'TMQ.Prod.Prod(System.Collections.Generic.Queue<TM Q.TheRec>)'
C:\MQueue\TMQ\Program.cs 21 16 TMQ
using System;
using System.Collections.Generic;
using System.Text;
namespace TMQ
{
class TheRec
{
public string RecSymbol;
public string RecTime;
public double RecPrice;
public TheRec(string recsymbol, string rectime, double recprice)
{
this.RecSymbol = recsymbol;
this.RecTime = rectime;
this.RecPrice = recprice;
}
}
public class Prod
{
public Prod(Queue<TheRec> q)
{
_queue = q;
}
private Queue<TheRec> _queue;

static void Main(string[] args)
{
Queue<TheRec> OPQ = new Queue<TheRec>();
}
}
}
May 24 '06 #1
1 1662
"A. Burch" <a1****@msn.com> wrote:
Error 1 Inconsistent accessibility: parameter type
'System.Collections.Generic.Queue<TMQ.TheRec>' is less accessible than
method 'TMQ.Prod.Prod(System.Collections.Generic.Queue<TM Q.TheRec>)'
C:\MQueue\TMQ\Program.cs 21 16 TMQ class TheRec
This class is internal, not public.
public class Prod
{
public Prod(Queue<TheRec> q)


And here you have a public constructor of a public class which expects a
parameter which can never be supplied by users of this class Prod which
are not inside this assembly - namely, TheRec.

The solution is either to make Prod internal (i.e. remove the 'public')
or make TheRec public (i.e. add 'public' to TheRec).

-- Barry

--
http://barrkel.blogspot.com/
May 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: justanotherguy63 | last post by:
Hi, I am designing an application where to preserve the hierachy and for code substitability, I need to pass an array of derived class object in place of an array of base class object. Since I...
7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
2
by: Jeff Bush | last post by:
I am trying to create a generic Command object (following the Command design pattern) that allows me to specify a generic type, an object to operate on, and most importantly, a public Property on...
7
by: Tim | last post by:
When there is a need to pass some dynamic information between 2 managed assemblies, the "Dictionary object" in Generic form can be used as a method parameter to pass the information. The...
4
by: Charles Churchill | last post by:
I apologize if this question has been asked before, but after about half an hour of searching I haven't been able to find an answer online. My code is beloiw, with comments pertaining to my...
1
by: Néstor Sánchez A. | last post by:
Hi, is there a way, maybe using reflection, to use a generic class passing the type parameter dynamicly (not kwnowing the exact type at compile time)? I tried the next example, but doesn't work: ...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
8
by: MMAS | last post by:
Hey everyone -- Curious about some strange behaviour I'm seeing that seems to be related to my lack of understanding on how generics work in C#. Here's some simplified code (sorry for strange...
2
by: Andrus | last post by:
Winforms UI assembly has static FormManager.FormCreator method which creates forms taking entity as parameter. I need to pass this method to business objects in business assembly so that business...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.