[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Passing a Generic as a Parameter

Mike

3/5/2008 7:37:00 PM

This seems like something that should be possible, but I am having
trouble setting up a function to accept a generic type as a parameter.

A basic function that shows what I am trying to do:

Public Class BaseRecord(Of T)
Protected _id As Integer
Public ReadOnly Property ID() As Integer
Get
Return _id
End Get
End Property
End Class

Public Class StringRecord
Inherits BaseRecord(Of String)

Private _value As String
Public ReadOnly Property Value() As String
Get
Return _value
End Get
End Property
End Class

Public Class Validation
Public Shared Function ValidateRecord(ByVal record As
BaseRecord(Of Object)) As Boolean
If record.ID < 0 Then
Return False
Else
Return True
End If
End Function
End Class

However, when I try to call the validation function like this:

Dim rec As New StringRecord()
Validation.ValidateRecord(rec)

I get an error stating "Value of type StringRecord cannot be converted
to BaseRecord(Of Object)"

I have tried making the function "Byval record as BaseRecord(Of T)"
but it states that "Type T is not defined"

Is there a way to pass this record as I am attempting or do I need to
completely rethink the way I am wanting to do validation?

Thank you,
Mike
14 Answers

SMITH29

7/19/2008 11:08:00 PM

0

Bill Shatzer wrote:
> SMITH29 wrote:
>
>> Here you go!!!
>> The Communists have the answer.
>> Nationalize American factories and industry.
>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...
>
>
> The CPUSA is only slightly less irrelevant than the Prohibition Party.
> And only slightly more so than the Libertarians.
xxxx
Oh yeah, Socialist/Communist ideals mean nothing.

>
> Still, one wonders how you manage to conflate -one- posting on a blog
> with "The Communists"?
xxxx
What's this? " Plausible Deni ability"?
>
> It's a CPUSA blog for certain but The Communists are hardly the only
> ones who go there - you rather obviously went there - and they are
> hardly the only ones who can post there.
xxxx
I keep track of the Communists. That's how I learned they want a
Democrat for president because the two party's feel the same about just
about every topic what with the Democrats going socialist on us.
>
> Hell, for all we know, it's YOUR posting, acting as an agent provocateur
xxxx
The post sounds a lot more like you than me, what with your anti
everything about the stock market and American products and production.

>
>> VOTE OBAMA!!!
>
> Ah, the rightwad "mind" truly "works" in mysterious ways - finding some
> strange connection between a single anonymous posting on a blog site and
> the presumptive democratic nominee for President of the United States.
>
> Sometime when I've got about three hours to waste, you'll have to
> explain to me just how you came up with THAT particular connection.
xxxx
As a Moonbat you are brainwashed beyond recovery.
>
> [I'd note, in passing, that neither "mind" nor "works" is an accurate
> description of what's going on there but I'll be damned if the English
> language seems to contain a more appropriate descriptive word. Perhaps
> "ersatz mind" and "random neuron firings" come closest.]
xxxx
Crack the books Shatzie, yer slipping.
>
> Peace and justice,
>

Don Homuth

7/19/2008 11:17:00 PM

0

On Sat, 19 Jul 2008 16:07:34 -0700, SMITH29 <smith29@comcast.net>
wrote:

>Bill Shatzer wrote:
>> SMITH29 wrote:
>>
>>> Here you go!!!
>>> The Communists have the answer.
>>> Nationalize American factories and industry.
>>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...
>>
>>
>> The CPUSA is only slightly less irrelevant than the Prohibition Party.
>> And only slightly more so than the Libertarians.
>xxxx
>Oh yeah, Socialist/Communist ideals mean nothing.

Yeah -- that's the case pretty much any more.

The Wingnuts still rant more than any sensible person would about
Cawmnists and all, by and large have No idea what the term Socialist
really means, either in an historical or political sense.

Communism is now pretty much a done deal in the world.

And the original term was, for the sake of things like the Comintern
purpose, not really applicable anyway. It was replaced by
Marxism/Leninism as a change to how the original was used.

Socialism is still, however, being operationalized, but primarily by
the Big Bidniss types. They prefer to Socialize costs and Privatize
benefits -- then claim they believe in things like Free Markets.

What's entertaining is how the Wingnuts so willingly buy into that
sort of economic and political drivel.

So it's become easy enough:

* If someone You like gets a gubmint benefit, that's not Soshlism.

* If someone You don't like gets a gubmint benefit, that's Soshlism.

And it's all nonsense.

SMITH29

7/20/2008 12:58:00 AM

0

Don Homuth wrote:
> On Sat, 19 Jul 2008 16:07:34 -0700, SMITH29 <smith29@comcast.net>
> wrote:
>
>> Bill Shatzer wrote:
>>> SMITH29 wrote:
>>>
>>>> Here you go!!!
>>>> The Communists have the answer.
>>>> Nationalize American factories and industry.
>>>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...
>>>
>>> The CPUSA is only slightly less irrelevant than the Prohibition Party.
>>> And only slightly more so than the Libertarians.
>> xxxx
>> Oh yeah, Socialist/Communist ideals mean nothing.
>
> Yeah -- that's the case pretty much any more.
xxxx
So the Democratic Party Platform means nothing.
Got It!!!!!!!

29

SMITH29

7/20/2008 1:18:00 AM

0

Bill Shatzer wrote:
> SMITH29 wrote:
>
>> Bill Shatzer wrote:
>
>>> SMITH29 wrote:
>
>>>> Here you go!!!
>>>> The Communists have the answer.
>>>> Nationalize American factories and industry.
>>>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...
>
>
>>> The CPUSA is only slightly less irrelevant than the Prohibition
>>> Party. And only slightly more so than the Libertarians.
>
>> Oh yeah, Socialist/Communist ideals mean nothing.
>
> As an ideology, communism lies on the ash heap of history. Such as still
> call themselves communists are interesting historical artifacts and
> little more.
xxxx
Well, that means the Democratic Party is in the Ash heap too for the two
partys sound the same and have about the same ideals.

29

Bill Shatzer

7/20/2008 3:11:00 AM

0

SMITH29 wrote:
> Bill Shatzer wrote:
>
>> SMITH29 wrote:

>>> Bill Shatzer wrote:

>>>> SMITH29 wrote:

>>>>> Here you go!!!
>>>>> The Communists have the answer.
>>>>> Nationalize American factories and industry.
>>>>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...

>>>> The CPUSA is only slightly less irrelevant than the Prohibition
>>>> Party. And only slightly more so than the Libertarians.

>>> Oh yeah, Socialist/Communist ideals mean nothing.

>> As an ideology, communism lies on the ash heap of history. Such as
>> still call themselves communists are interesting historical artifacts
>> and little more.

> Well, that means the Democratic Party is in the Ash heap too for the two
> partys sound the same and have about the same ideals.

The difference, of course, is that the democratic party controls both
houses of congress and is six months away from controlling the white house.

The communist party controls nothing except maybe a seat or two on the
Bard College Student Senate.

And, of course, the party the democratic party most resembles is the
republican party.

bT will be glad to enlighten you 'bout why that is so if he ever gets
off his current anti-Obama, anti-Homuth rants.


Peace and justice,

SMITH29

7/20/2008 3:32:00 AM

0

Bill Shatzer wrote:
> SMITH29 wrote:
>> Bill Shatzer wrote:
>>
>>> SMITH29 wrote:
>
>>>> Bill Shatzer wrote:
>
>>>>> SMITH29 wrote:
>
>>>>>> Here you go!!!
>>>>>> The Communists have the answer.
>>>>>> Nationalize American factories and industry.
>>>>>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...
>
>
>>>>> The CPUSA is only slightly less irrelevant than the Prohibition
>>>>> Party. And only slightly more so than the Libertarians.
>
>>>> Oh yeah, Socialist/Communist ideals mean nothing.
>
>>> As an ideology, communism lies on the ash heap of history. Such as
>>> still call themselves communists are interesting historical artifacts
>>> and little more.
>
>> Well, that means the Democratic Party is in the Ash heap too for the
>> two partys sound the same and have about the same ideals.
>
> The difference, of course, is that the democratic party controls both
> houses of congress and is six months away from controlling the white house.
xxxx
Don't try to rearrange the issue.
The Communist Party and the Democratic Party promote the same ideas.
>
> The communist party controls nothing except maybe a seat or two on the
> Bard College Student Senate.
xxxx
Control is not the issue.
>
> And, of course, the party the democratic party most resembles is the
> republican party.
xxxx
That's so stupid I can't believe you can't promote a better argument,.

If you want to be a Socialist or a Communist or a Democrat just study
the politic and decide for yourself.
I certainly won't be against your decisions but at least recognize where
you are and acknowledge that with yourself so you don't think I'm
attacking you for your thinking.
I oppose Communism because of it's history and lack of moral principals
and freedom for the people.


> bT will be glad to enlighten you 'bout why that is so if he ever gets
> off his current anti-Obama, anti-Homuth rants.
xxxx
Please, I'm not one to be brainwashed.

>
>
> Peace and justice,
>

Citizen Cane

7/20/2008 3:37:00 AM

0

Bill Shatzer wrote:

> The communist party controls nothing except maybe

The entire ant-war movement.

Stop lying, Shit-for-brains.

Bill Shatzer

7/20/2008 4:21:00 AM

0

SMITH29 wrote:

-snip-

> Please, I'm not one to be brainwashed.

Of course not - that would require you to actually possess one to be washed.

Pax et justim,


Citizen Cane

7/20/2008 4:42:00 AM

0

Bill Shatzer wrote:

> Pax et justim,
>
>

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

"And over 4,000 Americans have paid with their lives for that little
adventure. Plus a half a trillion dollars in national treasure


You might compare that with the number of lives lost on 9-11. Or the
economic injury incurred from that event.


It would have been cheaper in both lives and money to just suffer
another 9-11 every six or seven years.


Peace and justice,"

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Don Homuth

7/20/2008 3:12:00 PM

0

On Sat, 19 Jul 2008 17:58:25 -0700, SMITH29 <smith29@comcast.net>
wrote:

>Don Homuth wrote:
>> On Sat, 19 Jul 2008 16:07:34 -0700, SMITH29 <smith29@comcast.net>
>> wrote:
>>
>>> Bill Shatzer wrote:
>>>> SMITH29 wrote:
>>>>
>>>>> Here you go!!!
>>>>> The Communists have the answer.
>>>>> Nationalize American factories and industry.
>>>>> http://cpusaelections.blogspot.com/2008/07/first-step-for-autoworkers-w...
>>>>
>>>> The CPUSA is only slightly less irrelevant than the Prohibition Party.
>>>> And only slightly more so than the Libertarians.
>>> xxxx
>>> Oh yeah, Socialist/Communist ideals mean nothing.
>>
>> Yeah -- that's the case pretty much any more.
>xxxx
>So the Democratic Party Platform means nothing.
>Got It!!!!!!!

An interesting non sequitur.

Where do you plan to go with it?