﻿# V3005\. The 'x' variable is assigned to itself\.

The analyzer has detected a potential error: a variable is assigned to itself\.

The real\-world code example:

```cpp
public GridAnswerData(
  int questionId, int answerId, int sectionNumber,  
  string fieldText, AnswerTypeMode typeMode)
{
  this.QuestionId = this.QuestionId;
  this.AnswerId = answerId;
  this.FieldText = fieldText;
  this.TypeMode = typeMode;
  this.SectionNumber = sectionNumber;
}
```

The values of an object's properties are intended to be changed according to the method parameters, but mistakenly assigned its own value to the `QuestionId` property instead of the `questionId` argument's value\. 

The fixed code:

```cpp
public GridAnswerData(
  int questionId, int answerId, int sectionNumber,  
  string fieldText, AnswerTypeMode typeMode)
{
  this.QuestionId = questionId;
  this.AnswerId = answerId;
  this.FieldText = fieldText;
  this.TypeMode = typeMode;
  this.SectionNumber = sectionNumber;
}
```