Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added type converter support via TypeConverter<T> #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidfowl
Copy link
Contributor

@davidfowl davidfowl commented Sep 18, 2021

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
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
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

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