CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Guid
C#
//Stored Guid as a string
string strGuid = "5152A989-279F-4A81-AC68-4696966CD1E2"
//Creating a GUID obj based on that guid string
new Guid(strGuid);
by Egli   August 15, 2011 @ 6:12pm
Tags: .NET, Guid
77 Views
no comments
 
C#
string strFormatedGuid = Guid.NewGuid().ToString("N"); //Where N is the format, can be any of the ones described below
 
/*
Format: N
Output 32 digits:
00000000000000000000000000000000
 
Format: D
Output 32 digits separated by hyphens:
00000000-0000-0000-0000-000000000000
by Egli   August 02, 2011 @ 8:14pm
70 Views
no comments
 
Imports System.Text.RegularExpressions
 
Module Module1
 
    'http://learn.open.ac.uk/mod/oublog/viewpost.php?post=23031
    'www.ForkandBeard.co.uk
 
    Sub Main()
        Dim strUserNumbers As String()
        strUserNumbers = New String() { _
by Mitchell William Cooper   November 26, 2009 @ 5:28am
413 Views
no comments
 
Imports System.Text.RegularExpressions
 
Module Module1
 
    Sub Main()
        Dim strUserNumbers As String()
        strUserNumbers = New String() { _
              "H0W_BOvThemy84kies" _
              , "01543 MWC66" _
              , "8" _
by Mitchell William Cooper   November 26, 2009 @ 5:27am
279 Views
no comments
 
C#
using System;
using System.Runtime.InteropServices;
 
 
/// <summary>
/// Class that encapsulates the Win32 function CLSIDFromString.  Idea taken from
/// http://stackoverflow.com/questions/104850/c-test-if-string-is-a-guid-without-throwing-exceptions/287877#287877
/// </summary>
public static class GuidHelper
{
by Jon Sagara   September 22, 2009 @ 9:46pm
Tags: Guid, TryParse, C#, .NET
354 Views
no comments
 
C#
  /// <summary>
  /// Generates a unique Id as string
  /// </summary>
  /// <returns></returns>
  public static string GenerateUniqueId()
  {
      byte[] bytes = Guid.NewGuid().ToByteArray();
      return StringUtils.Base36Encode(BitConverter.ToInt64(bytes, 0));            
  }
by Rick Strahl   July 09, 2009 @ 2:23pm
Tags: C#, Unique Id, Guid
245 Views
no comments
 
C#
List<long> list = new List<long>();
 
byte[] bytes = Guid.NewGuid().ToByteArray();
long val = BitConverter.ToInt64(bytes,0);
 
val.Dump();
val.ToString("x").Dump();
val.ToString("x").Length.Dump();
 
for(int i=0; i<1000000; i++) {
by Rick Strahl   July 09, 2009 @ 1:21pm
Tags: C#, Guid, Unique Id
197 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate