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()!!!!


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: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: