Das ist einfach zu erklären: das funktioniertStack-Überlauf Ausnahme in C# Setter
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");
}
}
}
dies nicht
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");
}
}
}
ich eine Stapelüberlaufausnahme auf dem Setter in der zweiten Klasse bekommen, und ich tue Ich weiß nicht warum. Ich kann das erste Formular nicht verwenden, da es von Unity Engine nicht unterstützt wird
'ich nicht das erste Formular verwenden können, da sie von der Einheit engine' nicht unterstützt wird ... Die erste Form ist eine Compiler-Ebene eine Abkürzung. Es sollte gut mit Unity-Engine funktionieren. – SLaks
möglich Duplikat von [StackOverFlow auf Klasseneigenschaft] (http://StackOverflow.com/questions/680765/StackOverflow-On-Class-Eigenschaft) und viele andere. –
Nö, Einheit C# Compiler unterstützt diese Syntax nicht – Patrik