Reporter | Lilia Shamsutdinova (Lilia.Shamsutdinova) |
---|---|
Created | Apr 18, 2018 12:03:02 PM |
Updated | Apr 18, 2018 12:03:02 PM |
Subsystem | Refactorings |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Normal |
State | Submitted |
Type | Bug |
Fix version | Backlog |
Affected versions | 2018.2, 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
JetBrains ReSharper Ultimate 182.0.20180416.132916-eap00d.
internal class Book
{
public string Author { get; set; }
public string Title { get; set; }
}
public class ConvertAnonymousToNamedType
{
private string Test(List<Book> books)
{
var bookList = from book in books
select new { book.Author, book.Title };
var bookNew = bookList.ToList().FirstOrDefault(book => book.Author == "King");
return bookNew?.Author;
}
}
- Invoke Refactor This -> Replace Anonymous Type With Named Class on
new
innew { book.Author, book.Title }
. - Set "T.T" as Name.
Actual result:
No error message. Name considered valid.
Expected result:
"Identifier is not valid" error message is shown.
NOTE:
If proceed with name "T.T" then class "T" is created.