使用静态字段时键入Initialization Exception
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TypeIntailization_Exception
{
class TypeInit
{
// Static constructor
static TypeInit()
{
}
static readonly TypeInit instance = new TypeInit();
public static TypeInit Instance
{
get { return instance; }
}
TypeInit() { }
}
class TestTypeInit
{
static public void Main()
{
TypeInit t = TypeInit.Instance;
}
}
}
当运行这个我得到Type InTialization异常我怎么能避免这个...
没有找到相关结果
已邀请:
2 个回复
物崎巩
)。 您可以通过检查TypeInitializationException的
属性来查看真正的异常:
骂狮淋唐便