Click here to Skip to main content
15,891,184 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Coding vent post Pin
jeron18-Dec-21 3:53
jeron18-Dec-21 3:53 
GeneralRe: Coding vent post Pin
honey the codewitch8-Dec-21 4:02
mvahoney the codewitch8-Dec-21 4:02 
GeneralRe: Coding vent post Pin
jeron18-Dec-21 4:23
jeron18-Dec-21 4:23 
GeneralRe: Coding vent post Pin
honey the codewitch8-Dec-21 4:33
mvahoney the codewitch8-Dec-21 4:33 
GeneralRe: Coding vent post Pin
jeron18-Dec-21 4:47
jeron18-Dec-21 4:47 
GeneralRe: Coding vent post Pin
honey the codewitch8-Dec-21 5:23
mvahoney the codewitch8-Dec-21 5:23 
GeneralRe: Coding vent post Pin
jeron18-Dec-21 5:28
jeron18-Dec-21 5:28 
Generalmy first source code generator, yea!.. and a question Pin
Super Lloyd7-Dec-21 13:06
Super Lloyd7-Dec-21 13:06 
Thanks to the newsletter article I finally write my very first own source code generator, yea! Smile | :)
I found none of the resource on the topic I found were both simple and super helpful, but the cumulative tips in all of them finally unlocked the skill for me!
Turns out it's very simple (the main hurdle is that your generator library need to target .Net Standard 2.0).. someone need to write a "source code generator for dummy" article distilled to the essential! Poke tongue | ;-P
(hey, maybe that's an idea hey?)

Anyway... I still am left with one.. conundrum?
I made a .resx to C# code generator. I know those exists out of the box, but the resulting class doesn't support static binding event if the current culture change, which is annoying with the live culture update support in my application.

I have a large chunk of code to enable live culture update, but I thought, wouldn't it be nice if I could have a different C# resource class hey? And now I have!

my conundrum is, the default resx class's property looks like that
C#
internal static string About {
    get {
        return ResourceManager.GetString("About", resourceCulture);
    }
}
whereas mine looks like that
C#
public static string? fsf { get; private set; }
public static string? hello { get; private set; }
public static string? name { get; private set; }

static partial void UpdateValues()
{
    var resources = GetDictionaries(Culture);
    fsf = GetResource("fsf", resources);
    hello = GetResource("hello", resources);
    name = GetResource("name", resources);
}

so the the default class pay a (negligible) cost on every property access, and my code pay another (negligible but bigger) cost on resource change (but none on property access).

and I keep wondering, which one is the best?
for context, this class is primarily used through databinding to inform a WPF UI.
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 7-Dec-21 19:19pm.

GeneralRe: my first source code generator, yea!.. and a question Pin
honey the codewitch7-Dec-21 14:32
mvahoney the codewitch7-Dec-21 14:32 
GeneralRe: my first source code generator, yea!.. and a question Pin
Super Lloyd7-Dec-21 15:43
Super Lloyd7-Dec-21 15:43 
GeneralRe: my first source code generator, yea!.. and a question Pin
honey the codewitch7-Dec-21 15:53
mvahoney the codewitch7-Dec-21 15:53 
GeneralRe: my first source code generator, yea!.. and a question Pin
Super Lloyd7-Dec-21 16:01
Super Lloyd7-Dec-21 16:01 
GeneralRe: my first source code generator, yea!.. and a question Pin
Super Lloyd7-Dec-21 16:12
Super Lloyd7-Dec-21 16:12 
GeneralRe: my first source code generator, yea!.. and a question Pin
honey the codewitch7-Dec-21 16:55
mvahoney the codewitch7-Dec-21 16:55 
GeneralRe: my first source code generator, yea!.. and a question Pin
Super Lloyd7-Dec-21 21:49
Super Lloyd7-Dec-21 21:49 
GeneralRe: my first source code generator, yea!.. and a question Pin
Richard Deeming7-Dec-21 22:32
mveRichard Deeming7-Dec-21 22:32 
GeneralRe: my first source code generator, yea!.. and a question Pin
Super Lloyd7-Dec-21 22:47
Super Lloyd7-Dec-21 22:47 
GeneralAn interesting blockchain read PinPopular
David O'Neil7-Dec-21 5:18
professionalDavid O'Neil7-Dec-21 5:18 
GeneralRe: An interesting blockchain read Pin
raddevus7-Dec-21 5:31
mvaraddevus7-Dec-21 5:31 
GeneralRe: An interesting blockchain read PinPopular
Fabio Franco8-Dec-21 0:00
professionalFabio Franco8-Dec-21 0:00 
GeneralRe: An interesting blockchain read Pin
raddevus8-Dec-21 3:14
mvaraddevus8-Dec-21 3:14 
GeneralRe: An interesting blockchain read Pin
Yortw8-Dec-21 8:44
Yortw8-Dec-21 8:44 
GeneralRe: An interesting blockchain read Pin
raddevus8-Dec-21 9:07
mvaraddevus8-Dec-21 9:07 
GeneralRe: An interesting blockchain read Pin
Gerry Schmitz7-Dec-21 6:16
mveGerry Schmitz7-Dec-21 6:16 
GeneralRe: An interesting blockchain read Pin
Fabio Franco8-Dec-21 0:07
professionalFabio Franco8-Dec-21 0:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.