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

  • Home
  • SEARCH
  • 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 7944015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:26:13+00:00 2026-06-04T00:26:13+00:00

By non-instance types I mean types which do not expose a public constructor, for

  • 0

By non-instance types I mean types which do not expose a public constructor, for lack of a better term.

I want to extend the BitConverter class with an overload of ToString() that takes a parameter of type Char, representing a value delimiter.

Why? By default, the ToString() call returns a string representation of a byte array, delimited by dash symbols. The signature does not allow you to specify a different delimiter, which I find very unfortunate.

Now because this is not an instance type, or maybe because I’m overloading a shared method, I’m having a hard time finding the proper syntax to define my extension method.

What am I doing wrong here, causing the overloads to not show up in IntelliSense:

Imports System.Runtime.CompilerServices

Module BitConverterExtensions
    <Extension()>
    Public Function ToString(ByVal converter As BitConverter, ByVal value() As Byte, ByVal delimiter As Char) As String
        Return BitConverterExtensions.ToString(converter, value, 0, value.Length, delimiter)
    End Function

    <Extension()>
    Public Function ToString(ByVal converter As BitConverter, ByVal value() As Byte, ByVal startIndex As Integer, ByVal delimiter As Char) As String
        Return BitConverterExtensions.ToString(converter, value, startIndex, value.Length, delimiter)
    End Function

    <Extension()>
    Public Function ToString(ByVal converter As BitConverter, ByVal value() As Byte, ByVal startIndex As Integer, ByVal length As Integer, ByVal delimiter As Char) As String
        Dim bytes As String = BitConverter.ToString(value, startIndex, length)
        Return bytes.Replace("-"c, delimiter)
    End Function

End Module

Or is it simply not possible to extend shared methods?

  • 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-06-04T00:26:15+00:00Added an answer on June 4, 2026 at 12:26 am

    It’s not possible to introduce an overload of a method on a shared / static type. Extension methods are feature whose usage is driven by instances of a type not the type itself.

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

Sidebar

Related Questions

I have two non-overlapping sets of types and want to make other set which
Does defining an instance as dynamic in C# mean: The compiler does not perform
What's a good technique to create a WinForms Form instance, display it (non-modally) but
Custom non-fatal exception derive from which class in asp.net 3.5?
Whilst asynchronous IO (non-blocking descriptors with select/poll/epoll/kqueue etc) is not the most documented thing
I am trying to serialize a list that contains non-system types. Below is my
I have a generic factory which caches an instance before return it (simplified code):
I have defined some complex data types, for instance: type drawer = { ...
The non nullable types include int and boolean. My question is how to update
I wish to set up a ActiveMQ instance (primarily as a STOMP server) which

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.