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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:45:28+00:00 2026-05-16T16:45:28+00:00

I have the following Extension Method Imports System.Runtime.CompilerServices Namespace Extensions Public Module IntegerExtensions <Extension()>

  • 0

I have the following Extension Method

Imports System.Runtime.CompilerServices
Namespace Extensions
    Public Module IntegerExtensions

        <Extension()>
        Public Function ToCommaDeliminatedNumber(ByVal int As Integer) As String

            Dim _input As String = int.ToString
            Select Case int
                Case Is > 99999 : Return _input.Remove(_input.Length - 3) & "k"
                Case Is > 9999 : Return Math.Round(Double.Parse(int / 1000), 1).ToString & "k"
                Case Is > 999 : Return String.Format("{0:N0}", int)
                Case Else : Return _input
            End Select

        End Function
    End Module
End Namespace

And in one of my classes I’m using

user.Reputation.ToCommaDeliminatedNumber

I am importing the Extensions Namespace into the Class, but the error I’m getting is…

‘ToCommaDeliminatedNumber’ is not a member of ‘Integer?’.

Can anybody tell me what I might be missing here? I do have other Extension Methods for Strings and Dates that work exactly as expected… I’m just at a loss on this one.

  • 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-16T16:45:29+00:00Added an answer on May 16, 2026 at 4:45 pm

    Judging from your error message it looks like user.Reputation is actually a Nullable(Of Integer), based on the trailing question mark (‘Integer?’). Is that correct?

    Your extension method is extending Integer, not Integer? (i.e., Nullable(Of Integer)), hence the error. So either provide an overload that handles Integer? or call Value on the nullable type:

    user.Reputation.Value.ToCommaDeliminatedNumber()
    

    You will need to check that it is not null (Nothing) otherwise an exception will be thrown. An overloaded method might look like this:

    <Extension()>
    Public Function ToCommaDeliminatedNumber(ByVal int As Integer?) As String
    
        Return int.GetValueOrDefault().ToCommaDeliminatedNumber()
    
    End Function
    

    In the case that it’s null the default value of 0 would be displayed.

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

Sidebar

Related Questions

I have the following extension method: public static void ThrowIfArgumentIsNull<T>(this T value, string argument)
I have the following extension method public static T Field<T>(this DataRow row, string columnName)
I have following extension method written: static public IQueryable<OutboundPattern> ByClientID(this IQueryable<OutboundPattern> qry, int clientID)
I have created an extension method called AddGZip which looks like the following: public
I have the following extension method, and would like to make it more generic
I have the following extension method to add the elements in one collection to
I have the following extension method that takes a List and converts it to
In some legacy code I have seen the following extension method to facilitate adding
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public

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.