小编Jay*_*Fix的帖子

C#,. NET:隐藏DOS命令提示符窗口

在C#和.NET中,我编写了一个在Form(使用Windows.System.Forms)中运行的应用程序.我使用InnoSetup进行安装,我可以通过Windows的"开始"按钮启动应用程序.

我的问题:DOS命令提示符窗口与表单一起出现.如何防止DOS窗口出现?

.net c# forms command-line

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

C#中的反射 - 想要一个类'字段的数据类型列表

我的C#类MyClass(下面)有成员a,b,c,d,e和f.

我想使用反射来获取这些成员的数据类型列表; 例如(借用Python表示法):[char [],ushort,char,byte,uint,ulong].

class MyClass
{
    public  char [ ]    a ;
    public  ushort      b ;
    public  char        c ;
    public  byte        d ;
    public  uint        e ;
    public  ulong       f ;
}

class MainClass
{
public static void Main ( string [] args )
    {
        // get an array (or some kind of list) of MyClass' fields' data types ...
        // for example:  { char[], ushort, char, byte, uint, ulong }

        // I've tried the following, but can't …
Run Code Online (Sandbox Code Playgroud)

c# reflection types field

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

.NET FieldInfo - 获取**是*字段的对象

如何以编程方式获取对FieldInfo对象为字段的对象的引用?

例如,我想要这样的事情:

myFieldInfo.GetOwner(); // returns the object of which myFieldObject is a field
Run Code Online (Sandbox Code Playgroud)

.net c# reflection field

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

.NET反射:确定类字段的大小

目标:以编程方式确定类的字段的大小(以字节为单位).例如,请参阅下面的评论......

class MyClass
    {
    public  byte    b ;
    public  short   s ;
    public  int i ;
    }

class MainClass
    {
    public static void Main()
        {
        foreach ( FieldInfo fieldInfo
            in typeof(MyClass).GetFields(BindingFlags.Instance
             | BindingFlags.Public | BindingFlags.NonPublic) )
            Console.WriteLine ( fieldInfo.FieldType ) ;

        // output is:
        //    System.Byte
        //    System.Int16
        //    System.Int32

        // desired: to include "sizeof" each type (in bytes) ...
        //    System.Byte     1
        //    System.Int16    2
        //    System.Int32    4
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# reflection field sizeof

1
推荐指数
1
解决办法
2128
查看次数

标签 统计

c# ×4

field ×3

reflection ×3

.net ×2

command-line ×1

forms ×1

sizeof ×1

types ×1