Git Product home page Git Product logo

Comments (6)

DavidArno avatar DavidArno commented on July 17, 2024

What would using Foo; actually end up as in any expanded, compile-time, code? Presumably using Foo is just shorthand for eg

private readonly using Foo SomeFoo = new Foo();

and thus you'd presumably want Myclass.Finalize() to be auto-implemented/extended at compile time to ensure ((IDisposable)Foo).Dispose(); was called when the MyClass instance was garbage collected?

from csharplang.

HaloFour avatar HaloFour commented on July 17, 2024

@maxtoroq What exactly are Foo, Bar or Baz? How does this translate to existing code? It's difficult to tell because you provide very little context and your code sample seems very incomplete, but if I had to guess I would say that it's a dupe of dotnet/roslyn#181.

from csharplang.

alrz avatar alrz commented on July 17, 2024

I think this ain't about disposables. It's more likely to be a duplicate of dotnet/roslyn#4491.

from csharplang.

HaloFour avatar HaloFour commented on July 17, 2024

Ah, makes sense. Context is useful.

from csharplang.

alrz avatar alrz commented on July 17, 2024

Using this you can make yourself a scoped Self type (if you have multiple types in a file),

class C
{
  using Self = C;
}

You can use an analyzer to make sure that type aliases named Self are identical to the enclosing type.

from csharplang.

Thaina avatar Thaina commented on July 17, 2024

I think this would also enable my proposal

dotnet/roslyn#16958

from csharplang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.