Back to "Yksinkertainen Guid-valitsin..."

This is a viewer only at the moment see the article on how this works.

To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk

This is a preview from the server running through my markdig pipeline

C# Imported mostlylucidcouk Software Development

Yksinkertainen Guid-valitsin...

Wednesday, 19 May 2004

Toinen melko yksinkertaisista tehtävistäni (kollegani Jonny Anderson itse asiassa kirjoitti sen) - tällä kertaa vain yksinkertainen tapa vahvistaa Guid - tässä toteutuksessa ohitat Guidin "out"-parametrina sekä merkkijonon, jota haluat testata - se täyttää Guidin ja palaa tosi-/väärin riippuen siitä, onko Guid pätevä...

Private static Regex isGuid = uusi Regex (@"^){){0,1}[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(}) {0,1

Sisäinen staattinen booli IsGuid (jousi ehdokas, ulos Guid ulostulo)

{

bool isValid = false;

output=Guid.Empty;

if(ehdokas! = null)

{

if (isGuid.IsMatch (ehdokas))

{

output=uusi Guid (ehdokas)

isValid = totta;

}

}

paluu on Valid;

} ?>

logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.