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

The Archive Base Latest Questions

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

The Question Aside from all the obvious answers, what would cause extension methods to

  • 0

The Question

Aside from all the obvious answers, what would cause extension methods to generate compiler errors like this one:

‘DataType’ does not contain a definition for ‘YourExtensionMethodName’

I’ve got a real stumper here, and it’s spelled out for you in detail below. I’ve exhausted all the possible causes I can think of.

Scenario

  • I have a couple of extension methods defined in various static classes in a DLL that is consumed by a WinForms application.
  • The extension method signatures do not conflict with the signatures of methods on the class I’m extending (String, in this case).
  • Both the DLL and the WinForms application are written in C#.
  • Both the DLL and the WinForms application are configured to target .NET 3.5.
  • The consuming classes include a reference to the namespace that defines the extension method. Its spelling has been verified.
  • If I reference the extension class directly, the extension methods appear. For example, if I type StringExtensions., Intellisense appears as normal, with all of my extension methods listed.
  • EDIT: The errors are occurring in the WinForms application, but only for some of the extension methods, not all of them.

The Code (Or an Excerpt Thereof)

(Yep, this is the offending code)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Roswell.Framework
{
    public static class StringBuilderExtensions
    {
        public static string ToSentenceCase(this string value)
        {
            return value.Substring(0, 1).ToUpper() + value.Substring(1).ToLower();
        }

        public static string ToTitleCase(this string value)
        {
            string[] parts = value.Split(new string[] {" "}, StringSplitOptions.None);
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            foreach (string part in parts)
            {

                builder.Append(part.ToSentenceCase());
                builder.Append(" ");
            }
            return builder.ToString();
        }

    }
}

And this is the code that consumes it:

using Roswell.Framework;

namespace Roswell.Windows.Command
{
    /// <summary>
    /// Views the SQL for an object in the database window.
    /// </summary>
    internal class ViewObjectDdlCommand
        : MainWindowCommand
    {

        public override void Execute()
        {
           // ...

           OpenCodeWindow(
               string.Format("{0} - {1} - {2}", 
                             dsn.Name, 
                             objectName, 
                             info.ToTitleCase()),
                schemaItemType,
                objectName);
         }
    }
}
  • 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:09:04+00:00Added an answer on May 12, 2026 at 4:09 pm

    From your code snippet, I can see you’re calling ToTitleCase on something called info. But I can’t see the type of that variable, which is the thing that will determine what is happening here.

    Obviously it needs to be a string (if string was not a sealed class it could be something derived from string, but that’s impossible for a sealed class).

    So the only thing that makes sense (aside from a very unlikely compiler error) is that info is not a string.

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

Sidebar

Related Questions

This is in reference to a question I asked earlier. Aside from viewing the
Leaving aside the question of whether you should serve single or multiple stylesheets, assuming
Question Alright, I'm confused by all the buzzwords and press release bingo going on.
Question in the title. And what happens when all 3 of $_GET[foo] , $_POST[foo]
Question says it all, really. My application is a time tracker. It's currently written
Aside from the MVVM, as well as MVC patterns for the overall structure of
First of all, I have no idea if the title even reflects my question.
This question is long winded because I have been updating the question over a
Question: What are some good libraries that've been written in VB.NET? The best would
Question as stated in the title.

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.