Click here to Skip to main content
13,595,991 members
Rate this:
Please Sign up or sign in to vote.
See more:
HI am a new learner of C#.. I wanna do some project. in my project io have to generate email id optiions for the user from the first and last name i got from the user... ie: ",,"... Please suggest some methods for me...
Posted 10-Dec-12 4:27am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

To get email id that does not exist, you should have all the already existing ids in a database.

Then you look for the different combination firstlast, lastfirst, firstfirst, ...
And each time you find a matching id in your database, you create a counter a try one more time with this counter value (ex. firstlast1, then firstlast2, ...)

Or do avoid a lot of requests to the database, if you know SQL syntax, you can do a search like:
SELECT knownid FROM KnownIDTable WHERE knownid LIKE 'firstlast%'

and then analyze the rows to get the unique value for your counter.
Sergey Alexandrovich Kryukov 10-Dec-12 18:06pm
5. --SA
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you can concatenate first name and last name. but that will not always generate an unique mail id.

my suggestion is if you are building an application with a login , the login name should be unique value. you can get a combination of login name + first name+ last name
Pascal-78 10-Dec-12 10:51am
Adding text to an unique id does not keep it unique.
A + BC + D = AB + C + D = ABCD
A & AB are different strings but with added characters the result strings are identical.
Sergey Alexandrovich Kryukov 10-Dec-12 18:05pm
Good point. Another 5. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180621.3 | Last Updated 10 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100