Skip to content
March 19, 2008 / kiranpatils

Generating guid(Globally Unique Identifier) with .NET

I was playing with guid..initially i was getting same guid it was generating same Guid(000-000….)for all time…i was wondering about its strange behaviour..the code what i had written for it is as under:

//Not working

 public static Guid GetGuid()
{
return new Guid()

  }

at last i  found it’s solution:

 public static Guid GetGuid()
{
return Guid.NewGuid();
}

it will give new Guid everytime you call this function..Looks good na??Magic of NewGuid()!!!!

312a12b4-9853-45d2-8ccf-6d59ec940b41

NOTE: you can copy[if you can do try cut ] paste to you class call it.It will give you proper value means GUID

Happy guid!!!

One Comment

Leave a Comment
  1. ordersomabuyg / Sep 21 2008 10:12 am

    Wow Cool !
    Super Man
    Nice Site

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: