.NET Programming Weekly Issue 8 - April 26, 2020
0x00 C# how to convert a string to int
- It’s an interesting post. Although it seems to be a simple question, this post talks about a lot of content on this topic.
- Talk about
Parse
,TryParse
,Convert.ToInt32
,Exception handling
,Parsing complex strings
(via an overload of theTryParse
),Parsing anti-patterns
.
0x01 C# exception handling best practices
- A helpful post about exception handling best practices, such as
decorate exceptions
(Exception has a Data dictionary. The dictionary can be used to include additional information about an error.),catch the more specific exceptions
create custom exceptions
, etc.
0x02 How to write to a file with C# in 2020 - StackOverflow doesn’t get it right
- ‘I often find myself googling “simple” questions like how to write text to a file in the most quickly and effectively way. Most results are either blog posts using .NET 2 as an example, or StackOverflow answers from 2010. Common for all samples is that only the essential lines of code are added, and no focus on crucial aspects like error handling are highlighted.’
File.WriteAllText
.File.CreateText
.FileStream
, a good choice for writing asynchronously to a file from .NET is using theFileStream
class. Add true (useAsync
parameter) as the last parameter to theFileStream
constructor. This tells the FileStream to useasynchronous
IO.Exception handling
, including Problems with the path(DirectoryNotFoundException
,UnauthorizedAccessException
) and Problems while writing to disk(IOException
).
0x03 Deploying React apps to Azure with Azure DevOps
- It’s a helpful tutorial from creating a project to deploying the production to Azure Web App by using Azure Devops.
0x04 BUILD LEVELS QUICKLY in Unity with SNAPS!
- A video from YouTube shows how to create and prototype 3D levels in Unity using
Snaps
.
0x05 Microsoft Says it Hasn’t Given up on the VR Side of Windows Mixed Reality
- While Microsoft has been full steam ahead on the augmented reality side of Windows Mixed Reality via HoloLens, the company has had very little to say in the last year about the VR side of its platform. While it may look like Microsoft has largely given up on the effort, the company tells us that it remains committed.