如何从C#中的用户生成2个名称的不同选项 [英] How to generate different options from 2 names get from the user in C#

查看:94
本文介绍了如何从C#中的用户生成2个名称的不同选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#的新学员。我想做一些项目。在我的项目中,我必须从用户提供的名字和姓氏中为用户生成电子邮件ID optiions ...即:Firstlast @ x.com,lastfirst @ x.com,firstfirst @ x.com.. 。请为我建议一些方法...

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: "Firstlast@x.com, lastfirst@x.com, firstfirst@x.com"... Please suggest some methods for me...

推荐答案

要获取不存在的电子邮件ID,您应该拥有数据库中所有已存在的ID。 />


然后你寻找不同的组合firstlast,lastfirst,firstfirst,...

每当你在数据库中找到匹配的id时,你用这个计数器值再次尝试创建一个计数器(例如,firstlast1,然后是firstlast2,......)



或者避免大量的请求数据库,如果你知道SQL语法,你可以进行如下搜索:

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.


您可以连接名字和姓氏。但这并不总是会产生唯一的邮件ID。



我的建议是,如果您使用登录构建应用程序,则登录名应该是唯一值。您可以获得登录名+名字+姓氏
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


这篇关于如何从C#中的用户生成2个名称的不同选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆