public int x { get; private set; }
Or if you want both public, it would be:public int x { get; set; }
In ActionScript3 this would be:
The c# way is so much nicer - feature request Adobe!
private var _x:int;
public function get x():int
{
return _x;
}
public function set x(_x:int):void
{
this._x = _x;
}
7 comments:
In actionscript3 the set and get must share the same namespace/modifier thus you cannot have private setter and public getter.
Did you know you could convert c# to actionscript? :P
@zproxy
Yeah but you can have no setter at all, which pretty much achieves the same thing - a read-only property.
"Did you know you could convert c# to actionscript? :P"
- what automagically? how? (what happens to enums etc?)
Then there is Objective-C:
@property int x;
@synthesize x;
zproxy is talking about Alchemy:
http://labs.adobe.com/wiki/index.php/Alchemy
@Ickydime Alchemy is for c/c++ right? not c# - way different animal
@Keith Peters - thanks for the input by the way - always fun to peer over the fence at other languages.
There's a lot of other features C# has that I miss in action script: generics, the ability to include libraries from any other CLR platform languages, the ability to query remote domains, etc. Flash has one gigantic thing going for it though: the ability to run in browser on most platforms with hardware acceleration. So far, and Silverlight is playing catch up, big time.
Post a Comment