任何人都可以解释这个Que [英] Can Anyone explain this Que

查看:94
本文介绍了任何人都可以解释这个Que的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Security.Cryptography;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strTest = GetUniqueKey();
strTest = "BCL/2009/" + strTest;
Response.Write(strTest);
}
private string GetUniqueKey()
{
int maxSize = 8;
int minSize = 5;
char[] chars = new char[62];
string a;
a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
chars = a.ToCharArray();
int size = maxSize;
byte[] data = new byte[1];
RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider();
crypto.GetNonZeroBytes(data);
size = maxSize;
data = new byte[size];
crypto.GetNonZeroBytes(data);
StringBuilder result = new StringBuilder(size);
foreach (byte b in data)
{
result.Append(chars[b % (chars.Length - 1)]);
}
return result.ToString();
}
 
}

推荐答案

我们不能,不是真的 - 我们不知道你的技能,能力或兴趣,我们根本不知道你的课程会被接受的东西!



和你的导师交谈!他至少可以让你对预期的面积和尺寸有所了解,然后你可以专注于找到适合你感兴趣的参数。




回答错误的问题! :doh:
We can't, not really - we have no idea of your skills, abilities, or interests, and we definitely have no idea at all what would be considered acceptable by your course!

Talk to your tutor! he can at least give you some idea of areas and size expected, then you can focus on finding something within those parameters which fit what you are interested in.


Answered wrong question! :doh:


string strTest = GetUniqueKey();
strTest = "BCL/2009/" + strTest;
Response.Write(strTest);



此代码试图附加一个从函数获取的唯一键GetUniqueKey()字符串 BCL / 2009 /



GetUniqueKey (),阅读 RNGCryptoServiceProvider类 [ ^ ]。另请查看 C#RNGCryptoServiceProvider [ ^ ]。



如果您在Google中搜索,您可以获得许多其他有用的文章。


This code is trying to append one Unique Key got from function GetUniqueKey() with string BCL/2009/.

And for the GetUniqueKey(), read about RNGCryptoServiceProvider Class[^]. Also check C# RNGCryptoServiceProvider[^].

You can get many other useful articles, if you search in Google.

这篇关于任何人都可以解释这个Que的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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