Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# 7 #451

Closed
jnm2 opened this issue Feb 14, 2018 · 6 comments
Closed

C# 7 #451

jnm2 opened this issue Feb 14, 2018 · 6 comments
Assignees
Milestone

Comments

@jnm2
Copy link
Contributor

jnm2 commented Feb 14, 2018

While working on #296, I'm running into cases where I want to use default literals or ?? throw or is var and out var. For example:

while (fullName.TryGetNextNamespaceSegment() is var segment && segment != null)
{
    // ...
}

Instead of:

for (;;)
{
    var segment = fullName.TryGetNextNamespaceSegment();
    if (segment == null) break;
    // ...
}

Since none of the projects have an explicit version set, and the solution already requires VS2017, and @oznetmaster doesn't transpile this codebase to C# 3, it seems like C# 7 is guaranteed to be available to anyone in the code. Does this mean we accept C# 7.0 code?

What about using <LangVersion>latest</LangVersion> or 7.1 or 7.2 so that I can use default literals or readonly structs? C# 7.1 requires VS 15.3 (or a package reference) and C# 7.2 requires VS 15.5 (or a package reference).

@OsirisTerje
Copy link
Member

C# 7, yes. Latest, fine by me.

@jnm2
Copy link
Contributor Author

jnm2 commented Mar 3, 2018

You know what, I did mean this just as a question but I'm happy to help if there's something you had in mind.

@OsirisTerje
Copy link
Member

  1. Adding latest to all projects. As discussed earlier, there is no reason not to stay on the latest stable. If a problem arise from that, we just drop down to nearest downwards stable at that time.

But we should convert all to packagereference format first.

@jnm2
Copy link
Contributor Author

jnm2 commented Mar 3, 2018

@OsirisTerje Every csproj except the VSIX csproj is already using the new csproj SDK and PackageReference.
Last time I tried to convert a VSIX project to the new csproj SDK it didn't work. Is that something we should look into again?

Oh hey, look! I forgot I already added <LangVersion> latest to all the projects with C# source code, except empty-assembly and mock-assembly. Think that's good enough?

@jnm2
Copy link
Contributor Author

jnm2 commented Mar 4, 2018

💭 We could use PackageReference for the VSIX development-time dependency instead of https://github.com/nunit/nunit3-vs-adapter/blob/master/src/NUnit3TestAdapterInstall/packages.config. Should we?

@OsirisTerje
Copy link
Member

OsirisTerje commented Apr 2, 2018

@jnm2 Yes, we should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants