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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:42:35+00:00 2026-05-15T10:42:35+00:00

Dependency requirements are forcing me to have a class and its TypeConverter in different

  • 0

Dependency requirements are forcing me to have a class and its TypeConverter in different
assemblies.

Is there a way to assign a TypeConverter to a class without using a TypeConverterAttribute, and thus causing circular assembly references.

Thanks.

  • 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-15T10:42:36+00:00Added an answer on May 15, 2026 at 10:42 am

    Hmm, not sure I’ve seen this before, but you could add the TypeConverterAttribute at runtime using a TypeDescriptor, so given my sample classes:

    public class MyType
    {
        public string Name;
    }
    
    public class MyTypeConverter : TypeConverter
    {
        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        {
            if (sourceType == typeof(string))
                return true;
    
            return base.CanConvertFrom(context, sourceType);
        }
    
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value.GetType() == typeof(string))
                return new MyType() { Name = (string) value };
    
            return base.ConvertFrom(context, culture, value);
        }
    }
    

    I could then have a method:

    public void AssignTypeConverter<IType, IConverterType>()
    {
      TypeDescriptor.AddAttributes(typeof(IType), new TypeConverterAttribute(typeof(IConverterType)));
    }
    
    AssignTypeConverter<MyType, MyTypeConverter>();
    

    Hope that helps.

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

Sidebar

Related Questions

I'd like pip to install a dependency that I have on GitHub when the
There are two functional dependencies in the SQL databases. a) Partial functional dependency: A
I've been using the following memoizing decorator (from the great book Python Algorithms: Mastering
I have for instance 2 interfases IInterface1 and IInterface2 , public interface IInterface1 {...}
$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] $ rails -v Rails 2.3.5
Been trying to get my project up and running on an Ubuntu Virtual Box
I'm uploading a rails site to bluehost, a site that works on my local
I am trying to use RubyMine to run the tests in an existing project.
am new to Python packaging and am trying to work out which flags I
I am struggling in seting up a the basic architecture for my ASP.NET MVC

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.