Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Al Gonzalez

@Al Gonzalez
About
Posts
7
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Fluent Api in Pascal, nothing earth-shattering ...
    A Al Gonzalez

    In the C# chain, methods may return the same or different objects at any stage. The WITH block just calls the methods on the original object. ```csharp IThing thing = new ThingBuilder() // returns ThingBuilder instance .AddTitle("I'm a Thing!") // returns same ThingBuilder instance .CreatePreciousThing() // returns PreciousThing instance .SetPreciousLevel(100); // returns same PreciousThing instance // thing is now a PreciousThing instance ```

    The Lounge csharp delphi regex json

  • GIT Time again - what am I missing?
    A Al Gonzalez

    With Git you don't just have all the code on your local machine, you also have (or can have) all the branches, versions and tags on the local machine. That way you can compare or even revert code with any prior version without connecting a centralized server. Now when you want to share your changes, you can connect and push to say GitHub and pull to get changes from other users. Branching in Git is also more lightweight since it isn't a full copy of the code base. BTW, while PRs are useful and desirable when working with other developers, they are a feature of online git services like Github and Gitlab not Git itself. Depending on your settings/configuration, you CAN push changes to main (trunk) without anybody seeing it first.

    The Lounge collaboration announcement csharp visual-studio sysadmin

  • Keeping track
    A Al Gonzalez

    Just saw the reply from Andreas @User-3771503 and will be taking a look the **AzureDevOps.Technology-Framework-Monitor** project. Seems all the meta data could be useful. Mine is much simpler, but does store some details in a [LiteDB](https://www.litedb.org/) database file.

    The Lounge javascript dotnet csharp cloud css

  • Keeping track
    A Al Gonzalez

    I use the code repository API (in this case Azure DevOps) to scan all our projects for a `.csproj` files to get the .NET version being used. It can be modified if we have other Languages/SDKs/Frameworks in use. For example reading the `package.json` for the ***node*** and ***npm*** versions.

    The Lounge javascript dotnet csharp cloud css

  • Find My Keyboard Caret
    A Al Gonzalez

    I seem to have the issue when typing on my laptop and the touchpad thinks I clicked on something. I don't seem to have the issue when using an external keyboard. Changing the touchpad sensitivity seems to help.

    The Lounge help csharp visual-studio

  • C# 9 nullable reference alert
    A Al Gonzalez

    I would expect code that casts a List<string> to a IList to manage nulls. If I just want to return a simpler interface, I'd cast to IList<string>.

    The Lounge csharp com data-structures

  • Cosmetic vs More Efficient
    A Al Gonzalez

    I don't think it matters much as the compilers are pretty efficient at this. In C#, I usually use the "null coalescing assignment operator (??=)"; so "inVal ??= internalVal;". Here are some functions to test the various ways to assign a default value:

    void FixNullArg_SimpleIf(string arg = null) {
    if (arg == null)
    arg = "Fix null via simple if";
    Console.WriteLine(arg);
    }
    void FixNullArg_TernaryOp(string arg = null)
    {
    arg = (arg == null) ? "Fix null via ternary operator" : arg;
    Console.WriteLine(arg);
    }
    void FixNullArg_NullCoalescingOp(string arg = null)
    {
    arg = arg ?? "Fix null via ?? operator";
    Console.WriteLine(arg);
    }
    void FixNullArg_NullCoalescingAssignmentOp(string arg = null)
    {
    arg ??= "Fix null via ??= operator";
    Console.WriteLine(arg);
    }
    void FixNullArg_IsNullOrWhiteSpace(string arg = null)
    {
    arg = string.IsNullOrWhiteSpace(arg) ? "Fix null via IsNullOrWhiteSpace" : arg;
    Console.WriteLine(arg);
    }

    And here is the decompiled Intermediate Language (IL):

    FixNullArg_SimpleIf:
    IL_0000: nop
    IL_0001: ldarg.1
    IL_0002: ldnull
    IL_0003: ceq
    IL_0005: stloc.0
    IL_0006: ldloc.0
    IL_0007: brfalse.s IL_0010
    IL_0009: ldstr "Fix null via simple if"
    IL_000E: starg.s 01
    IL_0010: ldarg.1
    IL_0011: call System.Console.WriteLine
    IL_0016: nop
    IL_0017: ret

    FixNullArg_TernaryOp:
    IL_0000: nop
    IL_0001: ldarg.1
    IL_0002: brfalse.s IL_0007
    IL_0004: ldarg.1
    IL_0005: br.s IL_000C
    IL_0007: ldstr "Fix null via ternary operator"
    IL_000C: starg.s 01
    IL_000E: ldarg.1
    IL_000F: call System.Console.WriteLine
    IL_0014: nop
    IL_0015: ret

    FixNullArg_NullCoalescingOp:
    IL_0000: nop
    IL_0001: ldarg.1
    IL_0002: dup
    IL_0003: brtrue.s IL_000B
    IL_0005: pop
    IL_0006: ldstr "Fix null via ?? operator"
    IL_000B: starg.s 01
    IL_000D: ldarg.1
    IL_000E: call System.Console.WriteLine
    IL_0013: nop
    IL_0014: ret

    FixNullArg_NullCoalescingAssignmentOp:
    IL_0000: nop
    IL_0001: ldarg.1
    IL_0002: brtrue.s IL_000B
    IL_0004: ldstr "Fix null via ??= operator"
    IL_0009: starg.s 01
    IL_000B: ldarg.1
    IL_000C: call System.Console.WriteLine
    IL_0011: nop
    IL_0012: ret

    FixNullArg_IsNullOrWhiteSpace:
    IL_0

    The Lounge visual-studio com algorithms question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups