Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 86251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:13:00+00:00 2026-05-10T22:13:00+00:00

I was working with the generic class in vb.net. And it seems extension method

  • 0

I was working with the generic class in vb.net.
And it seems extension method cannot be applied to generic class without specifying the type.

I have this generic class

Public Class MyGeneric(Of T)     'Methods and properties go here      '     ' End Class   

This is Ok

<Extension()> _ Public Sub DoSomething(ByVal myGenericDoubleObj As MyGen(Of Double))  End Sub   

This is NOT Ok(IDE gives me error T as not defined.)

<Extension()> _ Public Sub DoSomethingGeneric(ByVal myGenericObj As MyGen(Of T))  End Sub 

Is this something to do with the static checking of the .Net.
Saying me ‘Something which may you try with doing with Type T is may not compatible and I will not allow you to do it.’

P.S. All the this pain I have taken as Generic Class comes from another library, And used at many different places. I am little wary of inheriting and adding this method in my inherited generic class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:13:01+00:00Added an answer on May 10, 2026 at 10:13 pm

    If you make your extension method a generic method it should work

    i.e DoSomething (Of T) () instread of just DoSomething()

    <Extension()> _ Public Sub DoSomething(Of T)(ByVal myGenericObj As MyGeneric(Of T)) End Sub 

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with a generic data structure, say MyGeneric<Type> . There is a
I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on
I'm currently working on a generic collection class and I'd like to create a
I've got a generic type: class DictionaryComparer<TKey, TValue> : IEqualityComparer<IDictionary<TKey, TValue>> And a factory
I'm trying to implement generic method to put in a class a calculated value
Working on a project at the moment and we have to implement soft deletion
I have an ASP.NET 3.5 SP1 web application that uses a custom JavaScriptConverter. The
I'm working on an application using ASP.NET MVC 1.0 and I'm trying to inject
I found user controls to be incredibly useful when working with ASP.NET webforms. By
So i have been playing around with the .NET RIA Services with Silverlight, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.