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

Move assertion extensions to properties with C#13 type extensions #213

Open
thomhurst opened this issue Jul 3, 2024 · 3 comments
Open

Comments

@thomhurst
Copy link
Owner

No description provided.

@SaileshBK
Copy link

SaileshBK commented Sep 21, 2024

Example: DateTimeExtensions.cs

For DateTime =>

public static extension DateTime
{
    private static readonly string? DateFormat = "yyyy/MM/dd";
    private static readonly string? LongTimeFormatWithMilliseconds = "hh:mm:ss.ffff tt";
    private static readonly string? LongDateTimeFormatWithMilliseconds = $"{DateFormat} {LongTimeFormatWithMilliseconds}";

    public string ToLongStringWithMilliseconds => this.ToString(LongDateTimeFormatWithMilliseconds);
}

Is this the pattern you are looking for @thomhurst ?

@thomhurst
Copy link
Owner Author

@SaileshBK Yeah that's along the lines of what I wanted to trial, but I heard it got delayed and isn't going to make it into C#13

@SaileshBK
Copy link

I will keep an eye on the feature itself, I am really excited about the C# 13 Type extensions as well. How about I work on this and slowly start migrating all the assertion extensions and make PR for it @thomhurst :)?

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

No branches or pull requests

2 participants