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

Update samples to .NET 5.0 #1224

Merged
merged 5 commits into from
Oct 28, 2020
Merged

Update samples to .NET 5.0 #1224

merged 5 commits into from
Oct 28, 2020

Conversation

richlander
Copy link
Member

@richlander richlander commented Oct 26, 2020

  • Updated the TFM.
  • Updated most of the samples to top-level programs.
  • Leverages target-type new() in a few places.

I think we can merge this at any time. We can wait until 11/10 if people want, but that doesn't seem necessary given the "go live" nature of the release.

Fixes #1190

@@ -8,12 +8,11 @@ namespace force_sensitive_resistor
{
class FsrWithCapacitorSample
{
private GpioController _controller;
private GpioController _controller = new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nifty 😄 I wasn't aware of this C#9 feature

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this is just a sample but given you are touching this line we might as well just add the readonly to _controller 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


namespace force_sensitive_resistor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand we are trying to showcase functional programming for c#9 here, but I wonder if we should stick with object oriented language given that these samples are supposed to be entry-level sort of examples?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'm open for discussion here, if you think it's best to keep it as you have it I'm fine too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like keeping that line would significantly reduce the value of top-level projects. Also seems like we're not losing much. I also don't think we're losing anything OO. It would be nice if you could declare the namespace with a single line that didn't require nesting the rest of the file.

@joperezr
Copy link
Member

I guess we don't have any of the samples in which the Readme tells you how to run it in Windows right? Because if we do, I think it would be good if in that sample we instead targeted net5.0-windows10.0.17763.0 in order to show folks how to use our library from the Windows side.

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments but this looks great otherwise. Thanks @richlander

@pgrawehr
Copy link
Contributor

I guess we don't have any of the samples in which the Readme tells you how to run it in Windows right? Because if we do, I think it would be good if in that sample we instead targeted net5.0-windows10.0.17763.0 in order to show folks how to use our library from the Windows side.

I could provide a binding that reads CPU temperatures, Fan speeds etc. for Windows (using an external library). This one is really Windows only (without actually needing the GPIO stuff, though) and is also a good example for the usage of units. Want to take a look?

@joperezr
Copy link
Member

While it would be good to have either that sample or a pointer to it somewhere in the repo, I think I would like to keep the samples section of the repo to specific usages of System.Device.Gpio. The idea with my question was to have one of these samples to target Windows, so having the right TFM to target that.

@richlander
Copy link
Member Author

I responded to the feedback and found some more opportunities for simplification (and uniformity) with dispose/using.

I took an initial take at documenting windows support. We probably need a central document along the lines of targeting-windows.md. Where do you think that document should live?

@richlander richlander merged commit 94c715f into dotnet:master Oct 28, 2020
@richlander richlander deleted the dotnet5 branch October 28, 2020 18:50
richlander added a commit that referenced this pull request Nov 3, 2020
* Update samples to .NET 5.0

* Update per feedback

* Resolve conflicts

* Remove duplicate project file

* Update NRT errors
richlander added a commit that referenced this pull request Nov 6, 2020
* Update samples to .NET 5.0

* Update per feedback

* Resolve conflicts

* Remove duplicate project file

* Update NRT errors
ZhangGaoxing pushed a commit to ZhangGaoxing/iot that referenced this pull request Mar 15, 2021
* Update samples to .NET 5.0

* Update per feedback

* Resolve conflicts

* Remove duplicate project file

* Update NRT errors
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move samples projects to .NET 5.0
3 participants