【问题标题】:What is the system type for a byte array - asp.net?字节数组的系统类型是什么 - asp.net?
【发布时间】:2008-11-19 06:41:20
【问题描述】:

我需要使用字节数组作为网站中的配置文件属性。通常我会将类型声明为 system.string 或 system.int32 但我不知道字节数组的类型。

编辑:我需要将其用作在 web.config 中声明的配置文件属性,如下所示:

<profile defaultProvider="ProfileProvider" enabled="true">
    <properties>
            <add name="Username" allowAnonymous="false" type="System.String" />
            <add name="LoginToken" allowAnonymous="false" type=" System.Byte()" />
        </properties>
</profile>

【问题讨论】:

    标签: asp.net vb.net


    【解决方案1】:

    我来自 C# 背景,所以我的回答并不准确,但我认为你想要这样的东西:

    system.byte[] myByteArray = new system.byte[50]();
    myByteArray[0] = 1;
    myByteArray[2] = 20; // etc, etc.
    

    【讨论】:

      【解决方案2】:

      显然 vb 希望它在 web.config 中声明为 System.Byte[]

      【讨论】:

      • 这不是 VB - 它是框架。 System.Byte[] 是从 CLR 和框架的角度来看的类型的名称。它恰好在 C# 中也有效,但这几乎是巧合(例如,泛型类型并非如此)。
      猜你喜欢
      • 1970-01-01
      • 2010-09-16
      • 2016-06-08
      • 2011-07-05
      • 1970-01-01
      • 2017-09-23
      • 1970-01-01
      • 1970-01-01
      • 2012-09-02
      相关资源
      最近更新 更多