© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
15 replies
Joreyk ( IXLLEGACYIXL )

How can i make that

    public static void Write<T>(this IYamlStream stream, string key, ref T value, DataStyle style = DataStyle.Any)
        where T : struct
    {
        stream.Serialize(ref key);
        
            var emitter = stream.Emitter;
            stream.SerializeContext.Serialize(ref emitter, value, style);
        
    }
    public static void Write<T>(this IYamlStream stream, string key, ref T value, DataStyle style = DataStyle.Any)
        where T : class
    public static void Write<T>(this IYamlStream stream, string key, ref T value, DataStyle style = DataStyle.Any)
        where T : struct
    {
        stream.Serialize(ref key);
        
            var emitter = stream.Emitter;
            stream.SerializeContext.Serialize(ref emitter, value, style);
        
    }
    public static void Write<T>(this IYamlStream stream, string key, ref T value, DataStyle style = DataStyle.Any)
        where T : class

why is this not allowed? isnt the type restriciton enough?
i want to differentiate between structs and classes so i have a null check where needed and no unnecessary boxing and stuff
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ How can i make clean tranparency
C#CC# / help
3y ago
how can i fix that code
C#CC# / help
3y ago
❔ How to make a program that can read this?
C#CC# / help
3y ago
❔ How can I make a program that interacts with other windows programs?
C#CC# / help
4y ago