Skip to content

Added type converter support via TypeConverter<T> - #7

Open
davidfowl wants to merge 1 commit into
DamianEdwards:mainfrom
davidfowl:davidfowl/type-converter
Open

Added type converter support via TypeConverter<T>#7
davidfowl wants to merge 1 commit into
DamianEdwards:mainfrom
davidfowl:davidfowl/type-converter

Conversation

@davidfowl

@davidfowl davidfowl commented Sep 18, 2021

Copy link
Copy Markdown
Contributor

Allows using System.ComponentModel.TypeConverter to bind types from string (route, query, header)

public readonly struct TypeConverter<TValue>
{
// Cache the type coverter instance for this generic type
private static readonly TypeConverter s_converter = TypeDescriptor.GetConverter(typeof(TValue));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this s_ abomination?


public override string ToString()
{
return Value!.ToString()!;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the compiler need the nullable escape here?

@mohammed-source

Copy link
Copy Markdown

Need office for work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants