相关疑难解决方法(0)

CS0120:非静态字段,方法或属性'foo'需要对象引用

考虑:

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //int[] val = { 0, 0};
            int val;
            if (textBox1.Text == "")
            {
                MessageBox.Show("Input any no");
            }
            else
            {
                val = Convert.ToInt32(textBox1.Text);
                Thread ot1 = new Thread(new ParameterizedThreadStart(SumData));
                ot1.Start(val);
            }
        }

        private static void ReadData(object state)
        {
            System.Windows.Forms.Application.Run();
        }

        void setTextboxText(int result)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new IntDelegate(SetTextboxTextSafe), new object[] { result });
            }
            else
            {
                SetTextboxTextSafe(result); …
Run Code Online (Sandbox Code Playgroud)

c#

242
推荐指数
6
解决办法
92万
查看次数

为什么我在C#中得到"非静态字段,方法或属性需要对象引用"错误?

我正在尝试在c#中实现AES,我遇到了错误.

到目前为止这是我的代码.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace aes1
{
class Program
{

    public byte[,] m_sbox = new byte[16, 16]   
           {{0x63 ,0x7c ,0x77 ,0x7b ,0xf2 ,0x6b ,0x6f ,0xc5 ,0x30 ,0x01 ,0x67 ,0x2b ,0xfe ,0xd7 ,0xab ,0x76}
           ,{0xca ,0x82 ,0xc9 ,0x7d ,0xfa ,0x59 ,0x47 ,0xf0 ,0xad ,0xd4 ,0xa2 ,0xaf ,0x9c ,0xa4 ,0x72 ,0xc0}
           ,{0xb7 ,0xfd ,0x93 ,0x26 ,0x36 ,0x3f ,0xf7 ,0xcc ,0x34 ,0xa5 ,0xe5 ,0xf1 ,0x71 ,0xd8 ,0x31 ,0x15}
           ,{0x04 ,0xc7 ,0x23 ,0xc3 ,0x18 ,0x96 ,0x05 ,0x9a ,0x07 …
Run Code Online (Sandbox Code Playgroud)

c# aes

2
推荐指数
2
解决办法
2091
查看次数

标签 统计

c# ×2

aes ×1