in reply to Re^2: Comparing Perl with C#, a simple templating example
in thread Comparing Perl with C#, a simple templating example
Thats just syntactic sugar. You may be able to use "properties" but in essence they just get re-written to the underlying subroutines anyway. Of course if you use code completion incorrectly you can get bitten :). Here's some recursive property code just for fun.C# even tries to beat Java with small things like how to define getter +s and setters.
Though I confess writing your own array accessor for an object is nice.using System; public class MyClass { private string person = ""; public string Person { set { this.Person = value; } get { return this.person; } } public static void Main() { MyClass app = new MyClass(); app.run(); } public void run() { string temp = "temp"; // Crash me this.Person = temp; } }
|
|---|