如何将C#代码转换为VB6代码 [英] How to convert the C# code to a VB6 code
本文介绍了如何将C#代码转换为VB6代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我需要创建一个包含Caeser Cipher的vb6代码(数学方法)
Hi everyone, I need to create a vb6 codes contains the Caeser Cipher (the mathematical method)
C = E(p) = (p + k) mod (26)
我的朋友刚刚在C#中创建了一个代码,但我需要将其转换为vb6(但不使用函数,因为我我不擅长这个)
如果有人可以帮我这个,我很感激
My friend just created a code in C# but i need to convert it to vb6 (but without using a function, because i am not good in this)
appreciate if someone can assist me with this
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.Composition;
public class Ceaser : SecurityAlgorithm
{
readonly int key;
#region Constructor
public Ceaser(int key)
{
this.key = key;
}
#endregion
#region Public Methods
public override string Encrypt(string plainText)
{
return Process(plainText, Mode.Encrypt);
}
public override string Decrypt(string cipher)
{
return Process(cipher, Mode.Decrypt);
}
#endregion
#region Private Methods
private string Process(string message, Mode mode)
{
string result = string.Empty;
foreach (char c in message)
{
var charposition = alphabet[c];
var res = Common.GetAlphabetPosition(charposition, key, mode);
result += alphabet.Keys.ElementAt(res % 26);
}
return result;
}
#endregion
}
}
推荐答案
听起来像家庭作业,但是请参阅 freevbcode [ ^ ]。
其他实施方式 [ ^ <在VB6中的/ a>]。
Sounds like homework, however see an implementation at freevbcode[^].
There are other implementations[^] in VB6 out there.
这篇关于如何将C#代码转换为VB6代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文