Tuesday, 15 March 2011

c# - Parameter values swapping -


The values ​​in my parameters are swapping with each other and I can not find any reason for this.

In my Controller, I return data from my repository with

UserTeam ut = _UserTeamRepository.GetUserTeam (userteamid: 0, gameid: gameid, userid: UserID) ; ,

When I reach the breakpoint in the controller in the above row, then gameid = 1 userid = 2

that's right. However, when (debugging again), I get access to the breakpoint inside the GetUserTeam repository method:

Public User GetUserTem (InterUtilemed = 0, Int Gamed = 0, Int User ID = 0)

He has switched magically - Gamed is now 2, User ID 1.

Is this a bug? What is happening?

The parameters are not the same as when there is some confusion with the named parameter interface (or virtual class of the base class) Method) because they are in the implementation (overriding) method.

  Interface IFace {void M (int user, int game); } Category C: IFace {Public Zero M (int game, int user) // Note Order here {{}}   

then calling M named parameter syntax It is used to confuse, especially since intellisense it goes wrong.

The famous authority Eric Lippert writes on the stack overflow:

uses overload resolution name more derived This is an unfortunate consequence of the fact that the logic in this game was very long added.

No comments:

Post a Comment