【发布时间】:2011-03-17 14:40:03
【问题描述】:
这行得通:
using System;
using ConstraintSet = System.Collections.Generic.Dictionary<System.String, double>;
namespace ConsoleApplication2
{
class test
{
public ConstraintSet a { get; set; }
public test()
{
a = new ConstraintSet();
}
static void Main(string[] args)
{
test abc = new test();
Console.WriteLine("done");
}
}
}
这不是:
using System;
using ConstraintSet = System.Collections.Generic.Dictionary<System.String, double>;
namespace ConsoleApplication2
{
class test
{
public ConstraintSet a { get { return a; } set { a = value; } }
public test()
{
a = new ConstraintSet();
}
static void Main(string[] args)
{
test abc = new test();
Console.WriteLine("done");
}
}
}
我在第二类的 a 的 setter 上遇到堆栈溢出异常,我不知道为什么。我不能使用第一种形式,因为Unity game engine 不支持它。
【问题讨论】:
-
I cannot use the first form because it is not supported by unity engine... 第一种形式是编译器级别的简写。它应该可以与统一引擎一起正常工作。 -
StackOverFlow on class property 和许多其他的可能重复。
-
不,unity c# 编译器不支持这种语法
标签: c# setter callstack stack-overflow