Questions about MMO demo client

Options
Amaz1ng
edited April 2011 in DotNet
this.actionQueue.EnqueueAction(
                () =>
                    {
                        this.itemPositions.Add(item, position);

                        // update radar every 10 seconds
                        IUnsubscriber positionUpdates = item.PositionUpdateChannel.SubscribeToLast(
                            this.fiber, this.UpdatePosition, Settings.RadarUpdateInterval);
                        IUnsubscriber disposeMessage = item.DisposeChannel.Subscribe(this.fiber, this.RemoveItem);
                        var unsubscriber = new UnsubscriberCollection(positionUpdates, disposeMessage);
                        this.itemSubscriptions.Add(item, unsubscriber);

                        this.PublishUpdate(item, position, Reliability.Unreliable);
                    });

What is the ()=> ?

Comments

  • Operation(OperationCode = (byte)OperationCode.CreateWorld)

    And this...what does this do?
  • public new void AddItem(Item item)
    {
    throw new ArgumentException("add MmoItem instead of Item");
    }

    And what the hell...what is this? How are you using "new" like this?
  • Boris
    Options
    Amaz1ng wrote:
    What is the ()=> ?
    It's called Lambda Expression; see http://msdn.microsoft.com/en-us/library/bb397687.aspx
  • Boris
    Options
    Amaz1ng wrote:
    Operation(OperationCode = (byte)OperationCode.CreateWorld)

    And this...what does this do?
    This is an attribute that is used only if you compile with conditional compilation symbol "OperationDispatcher". The operation dispatcher maps operation requests to methods with the Operation attribute; in this case operation code CreateWorld.
    If you don't use the operation dispatcher the requests are dispatched with a switch-case statement.
  • Boris
    Options
    Amaz1ng wrote:
    public new void AddItem(Item item)
    {
    throw new ArgumentException("add MmoItem instead of Item");
    }

    And what the hell...what is this? How are you using "new" like this?
    the "new" keyword is an alternative to "override". It's used if the base method is not "virtual".