求助!!哪位高人会PHP,帮我把这段代码转成C#的啊?急求!
<?php
class Sign{
static function mySign($para,$key,$secret)
{
$para_filter = self::paraFilter($para);
$para_sort = self::argSort($para_filter);
$mysign = self::buildMysign($para_sort, $key,$secret);
return $mysign;
}
static function paraFilter($para) {
$para_filter = array();
foreach($para as $key=>$value){
if($key == "sign" || $key == "filter" || $value == "")continue;
else $para_filter[$key] = $para[$key];
}
return $para_filter;
}
static function argSort($para) {
ksort($para);
reset($para);
return $para;
}
static function buildMysign($sort_para,$key,$secret) {
$prestr=$key;
$prestr = $prestr.self::createLinkstring($sort_para);
$prestr = $prestr.$secret;
//$prestr= utf8_encode( $prestr);
$mysign = strtoupper(sha1($prestr));
return $mysign;
}
static function createLinkstring($para) {
$arg = "";
foreach ($para as $key=>$value){
$arg .= $key.$value;
}
return $arg;
}
}
?>
PHP
C#
------解决方案--------------------大致是这样吧。。。
public class Sign
{
public static string mySign(Dictionary<string, string> para, string key, string secret)
{
var para_filter = paraFilter(para);
&