Skip to content

Rewrite New-Guid on C# #2733

Closed
Closed

Description

@iSazonov

As approved in #2718 New-Guid should be rewritten on C#.

Activity

  1. added
    WG-Cmdletsgeneral cmdlet issues
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Nov 20, 2016
  2. iSazonov commented on Nov 21, 2016

    @iSazonov
    CollaboratorAuthor

    Now it's just a wrapper for [system.guid]::NewGuid.
    It would be good to add new parameters:
    -Empty to get [system.guid]::Empty
    -Guid as [string] (with ValueFromPipeline)
    -NewGuid as default

  3. powercode commented on Nov 21, 2016

    @powercode
    Collaborator

    Starting work.
    @powershell/powershell assignment?

  4. lzybkr commented on Nov 21, 2016

    @lzybkr
    Contributor

    I disagree about adding -Empty and -Guid. Neither seem to fit with the New verb, and converting a string to a Guid happens where necessary automatically, at least I think it does.

  5. powercode commented on Nov 21, 2016

    @powercode
    Collaborator

    I agree about -Guid.
    But as Guids are values without identity, you create then with new-guid. Why not provide a way to create the sentinel guid?

    It is a lot more discoverable than [guid]::Empty, and easier to type on many keyboard layouts where
    '[' and ']' are AltGr+8 and AltGr+9.

  6. iSazonov commented on Nov 22, 2016

    @iSazonov
    CollaboratorAuthor

    Some applications use GUID as a unique identifier. In this case, the identifier is a string. So really, we can get a stream of strings (ex. from logs), that we want to convert to [guid]. And yes this is more for ConvertTo-Guid but I looked through New-* cmdlets and many of them do a similar operation (string -> object). Most likely the new ConvertTo-Guid cmdlet is redundant and perhaps it would be better to make the GUID parameter.

    Actually I'm surprised that New-Guid has appeared. But if it is, then it is logical to realize a full set of features including Empty. It is also used by some applications (ex. SCCM).

    If we do not do Guid and Empty and do not use pipeline there is an option to make a breaking change and remove New-Guid because there is [guid].

  7. iSazonov commented on Dec 2, 2016

    @iSazonov
    CollaboratorAuthor

    PowerShellTeam Please close the Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Resolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions