Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8871643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:02:26+00:00 2026-06-14T18:02:26+00:00

I am converting a string to a guid to check if the string is

  • 0

I am converting a string to a guid to check if the string is a valid guid , in c# .net 4.0
The string is :

string guid = "11111111-1111-1111-1111-111111111111";

This guid should be invalid for me , even though it have as many characters as a guid have. Is there a way to check if a guid looks like a “normal” guid with different chars and numbers?

All these methods dont work because they return the guid is valid for me.

Guid.Parse

Guid.TryParse

Guid.TryParseExact

Thank you!

EDIT :

To clarify, i need to check if my guid is like these Guids : dc6a1ad8-4743-4487-a28e-54d31870dfcb

We can discard the word “invalid” and “valid” because people seem to focus a bit on that. So i need make sure a guid looks more like this : dc6a1ad8-4743-4487-a28e-54d31870dfcb instead of this : 11111111-1111-1111-1111-111111111111

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:02:28+00:00Added an answer on June 14, 2026 at 6:02 pm

    If you just want to check whether the Guid has different characters, you can check the number of distinct bytes it contains:

    int count = yourGuid.ToByteArray().Distinct().Count();
    

    For Guid.Empty or 11111111-1111-1111-1111-111111111111, the result will be 1.
    For dc6a1ad8-4743-4487-a28e-54d31870dfcb, the result is 16.

    You’ll just need to decide how large the number needs to be for you to accept the Guid as “normal”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem in converting a string to double in .NET 3.5.
I need help converting a string to double with 7 decimals. I have a
I have a problem converting a string binary to a decimal I was using
I have a problem while converting a string whose value is dd.mm.yyyy to DateTime
I have a problem with converting string to float. print gettype($value[$id]); //returns string var_dump($value[$id]);//returns
Possible Duplicates: Is there a string math evaluator in .NET? Converting string expression to
I need help converting this string --> 20090727 10:16:36:643 to --> 07/27/2009 10:16:36 The
I have created a StringToMapConverter for converting string in predefined format to a Map
What is the difference between these two ways of converting a string to System.Guid
This is follow up for my last question about converting string to float I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.