Assemblies as Friends in C#

Sdílet
Vložit
  • čas přidán 5. 02. 2023
  • In this session, I'm going to show you how classes or assemblies can be friends in C#. This means that some private members, methods or classes in some assembly will only be exposed to friend assembly but not others.
    This feature is extremely important for test-driven systems and shared assemblies or libraries or nuget packages with external consumers.
    Here's a reference to this feature here:
    learn.microsoft.com/en-us/dot...
    Here's a link to LeVent project:
    github.com/hassanhabib/LeVent

Komentáře • 17

  • @bitzartdev
    @bitzartdev Před rokem +7

    I was actually fiddling with clean architecture, making everything internal and faced a problem that I don't know how to expose the internals to unit test projects. This solves my problem. Super useful, thank you!

    • @HassanHabib
      @HassanHabib  Před rokem +1

      Great to hear!

    • @ahmadkelany
      @ahmadkelany Před rokem

      +1
      faced the same problem just yesterday!
      @Hassan Habib do you have psychic powers?
      Of course, if you have, you'll have to deny it to protect your secret identity, I totally understand 😁 👍

  • @chaouanabil3087
    @chaouanabil3087 Před rokem

    Thank you so much Hassan, this is very helpful.

  • @Kenbomp
    @Kenbomp Před rokem

    Hot kteys make it hard to follow, but good explanation overall. Yes one of the problems with runtimes is security or a negative trade off

  • @Schnickalodeon
    @Schnickalodeon Před rokem

    Would that be used for class libraries which shares information too (If you have your models that are used in multiple projects in a separate project) or would you keep this classes public then?
    Like always an very interesting video! Thank you 😊

    • @HassanHabib
      @HassanHabib  Před rokem

      Models are not super big concern if they are anemic (data carriers). But services certainly not.

  • @kirillzlobin7135
    @kirillzlobin7135 Před 4 měsíci

    When we do this [assembly...] - it relates to the whole namespace or only to the part of this namespace declared in this certain file?
    Because we can divede oure classes which are in the same name space into multiple files

  • @imtempie
    @imtempie Před rokem

    Hey hassan, whats that device under your monitor?

    • @HassanHabib
      @HassanHabib  Před rokem

      Hey!
      It's a CZcams subscriber counter device - it's called LaMetric
      www.amazon.com/LaMetric-Time-Wi-Fi-Clock-Smart/dp/B01IVTVK3W/ref=as_li_ss_tl?ie=UTF8&qid=1490805120&sr=8-1&keywords=lametric&linkCode=sl1&tag=socialtech109-20&linkId=c529e282c3f8dfacdecbf5cc763003da

  • @johnhershberg5915
    @johnhershberg5915 Před rokem

    How come you prefer namespace blocks instead of top-level namespace definition?

    • @HassanHabib
      @HassanHabib  Před rokem +1

      namespace blocks are more consistent with how we scope classes, methods and everything else.

  • @lantisdylan
    @lantisdylan Před rokem

    Do you have a tutorial in blazor?

    • @HassanHabib
      @HassanHabib  Před rokem

      I do. Here it is:
      czcams.com/video/5Htj8JFglb4/video.html&ab_channel=HassanHabib

    • @lantisdylan
      @lantisdylan Před rokem

      @@HassanHabib thank you sir.