dotnet / dotnet/docs

Manually Registering a Custom TypeConverter

Open
#33,728 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
19h 10m
Merged PRs (30d)
268

Description

**Help us make content visible**

Search terms:
-How to register a custom type converter programmatically
-How to bound typeconverter to a type programmatically

Related docs:
-https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.typeconverter?view=net-7.0
-https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.typeconverterattribute?view=net-7.0

**Describe the new article**

There are currently no articles that explain how to register your custom type converter programmatically if you are unable to apply the TypeConverterAttribute or want to override the converter that is bound to the type. This may be needed for various reasons, one example is that perhaps the user does not own the type of interest, but there is no type converter bound to it or the behavior of the type converter bound to the type of interest has some unexpected behavior. WinForms has already written up a doc explaining the process of how a user can manually register a type converter [here](https://github.com/lonitra/winforms/blob/57ba5e9d19e789f526448a422e0ced39715884e7/docs/serialization/register-custom-type-converter.md). This can be used for the contents of the article. I'm not sure exactly where the best location would be, but perhaps this article could be linked in the "remarks" section and the "see also" section of the TypeConverter docs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.