jeudi 28 avril 2016

The contextual keyword 'var' may only appear within a local variable declaration Or In Script Code

Hey I'm trying to Define a mock database . I'm encountering an error while trying to equate var to Mock<'Repository'> The error is :

The contextual keyword 'var' may only appear within a local variable declaration Or In Script Code.

The Code that I have written is :

 public   class MockingDatabse
{
    //Mock a Payment Info
    var newPayment = new Mock<IPayment>();
}

I know that I can replace 'var' with 'Mock<"Repository">'. But I wanna know I'm not able to use 'var'

Aucun commentaire:

Enregistrer un commentaire