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 395551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:27:55+00:00 2026-05-12T16:27:55+00:00

Inspired by Javascripts variable Arguments in Max()/Min() and list comprehension in functional languages I

  • 0

Inspired by Javascripts variable Arguments in Max()/Min() and list comprehension in functional languages I tried to get the same in VB.NET using Generic Extension methods given IEnumerable(of T) as resulttype. This works well excepts for strings. Why?
These kind of extension methods may be considered a bad idea. Any strong reason Why this is a bad idea.

  Option Explicit On
    Option Strict On

    Imports System.Runtime.CompilerServices

    Module Module1

        Sub Main()
            Dim xs As IEnumerable(Of Integer) = 1.Concat(2, 3, 4)
            Dim ys As IEnumerable(Of Double) = 1.0.Concat(2.0, 3.0, 4.0)
            Dim zs As IEnumerable(Of String) = Concat("1", "2", "3", "4") 'silly but works, I would use a stringbuilder
            'Dim zs2 As IEnumerable(Of String) = "1".Concat("2", "3", "4")  ' does not work why?
            'Gives:
            'String' cannot be converted to 'System.Collections.Generic.IEnumerable(Of String)'
            'because() 'Char' is not derived from 'String', as required for the 'Out' generic parameter 'T' in 'Interface IEnumerable(Of Out T)'.
            'C:\Users\kruse\Documents\Visual Studio 10\Projects\VarArgsExperiment\VarArgsExperiment\Module1.vb  12  45  VarArgsExperiment

            Console.ReadLine()
        End Sub



        <Extension()> _
        Function Concat(Of T)(ByVal xs As IEnumerable(Of T), ByVal ParamArray params As T()) As IEnumerable(Of T)
            Dim ys As IEnumerable(Of T) = params.AsEnumerable()
            Return xs.Concat(ys)
        End Function

        <Extension()> _
        Function Concat(Of T)(ByVal x As T, ByVal ParamArray params As T()) As IEnumerable(Of T)
            Dim xs As New List(Of T)
            xs.Add(x)
            Dim ys As IEnumerable(Of T) = params.AsEnumerable
            Return xs.Concat(ys)
        End Function
End Module

… Cut of the rest of the module for being brief. Als wrote some methods for Add, Cast and an Apply for Action objects.

  • 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. Editorial Team
    Editorial Team
    2026-05-12T16:27:55+00:00Added an answer on May 12, 2026 at 4:27 pm

    A string is an IEnumerable<char>, and there’s no relation between a string and char. You can think of it as a problem with dimensions, a string can usually be thought of as an array of char. char[] does not equals char, nor will it ever. System.String also implements a method Concat which can mess with your type signature so you might wanna be careful with that.

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

Sidebar

Ask A Question

Stats

  • Questions 193k
  • Answers 193k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I would wrap the whole thing in an update panel,… May 12, 2026 at 6:40 pm
  • Editorial Team
    Editorial Team added an answer Try Python. Use BeautifulSoup to parse the HTML. The textwrap… May 12, 2026 at 6:40 pm
  • Editorial Team
    Editorial Team added an answer You need to create a class that implements IDisposable interface… May 12, 2026 at 6:40 pm

Related Questions

Inspired by this question . I commonly see people referring to JavaScript as a
Where do you put user input validation in a web form application? View: JavaScript
I have an application that I would like to embed inside our companies CMS.
I have a really long 3 column table. I would like to <table> <tr><td>Column1</td><td>Column2</td></tr>
I have been working on a project that dynamically creates a javascript file using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.