C Sharp tags

.Net Core Series - Publishing Portable Applications

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects Testing NuGet Multi-targeting Publishing Portable Applications <=(We are here) Self-contained Applications We can now take everything we have learned and start publishing our …

How to Constructors

Constructors for services are a really handy way to pass in configuration, variation and dependencies. Here are some ways I have learned to use Constructors and some ideas on testing. What shouldn’t be in a Constructor Execution. Any complex execution of code should not be in a constructor. This includes …

.Net Core Series - Multi-targeting

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects Testing NuGet Multi-targeting <=(We are here) Publishing Portable Applications Self-contained Applications Last time we learned how to package our libraries as NuGet packages. …

.Net Core Series - NuGet

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects Testing NuGet <=(We are here) Multi-targeting Publishing Portable Applications Self-contained Applications Let’s set aside Application packing for later, and focus our …

.Net Core Series - Testing

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects Testing <=(We are here) NuGet Multi-targeting Publishing Portable Applications Self-contained Applications We want to be able to test our application code that we build. …

Experimenting with global.json

While working on my .Net Core Series I noticed that Visual Studio was adding a global.json file to the root of my project, and liked to put src and test in there. I thought I would investigate what it actually does. I noticed that if all my project folders were next to each other it didn’t matter. So here is my …

.Net Core Series - Using Multiple Projects

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects <=(We are here) Testing NuGet Multi-targeting Publishing Portable Applications Self-contained Applications We know how to create new projects, we know how to build and run our …

.Net Core Series - What's in the box

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box <=(We are here) Using Multiple Projects Testing NuGet Multi-targeting Publishing Portable Applications Self-contained Applications Last time we created a new application. Once with dotnet CLI and once …

Visual Studio Code with C# and dotnet

Getting Started with Visual Studio Code? Me too. Let’s see what it takes to get going. This is a bit of a companion piece alongside my .Net Core Series I am writing at the moment. Hopefully as well as .Net Core, I will have a play with writing TypeScript, Rust and maybe C++ inside Visual Studio Code. I might have …

.Net Core Series - Getting Started

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started <=(We are here) What’s in the box Using Multiple Projects Testing NuGet Multi-targeting Publishing Portable Applications Self-contained Applications We finally got some finalised bits in a release this week. So here is …

using over lambda

Let’s talk about these two patterns: public void GetSomethingDone() { var metaData = "Some Sort of Metadata for timing"; var result = DoTimedWork(metaData, () => { MyResult resul; //Some other complicated work/method-call happens here return result; }); //either uses or returns result here } public T …

A couple of debugging tips

I had an idea of something I wanted to post, but a quick google turns up I posted it 6 months ago, so here are some debugging tips. Console Break So you are writing a console app? Cool. Want to see the output? Of course, you do. But when you run it, the app pops up then disappears really quickly right? No? Have you a …

ExternalAnnotations, or how to not depend on jetbrains.annotations.dll

There is some great static analysis stuff that ReSharper does for you. Specifically around nullability, purity and usage of your code. From their Code Annotations page in Visual Studio: ReSharper Annotations help reduce false positive warnings, explicitly declare purity and nullability in your code, deal with implicit …

Using C# 5.0 with Visual Studio 2015

Visual Studio 2015 is out and brings us the new C# 6 language features. We also have the new .Net 4.6 Runtime. But what does that mean? Well, the framework version and language version are two separate concerns. You can practically pick any framework, with any language, and it will work. This means that If you want to …

MethodImplAttribute and MethodImplOptions

I’ve been following some C development going on in the community, and discussion around memory management and optimisations lead me to start thinking about how they might be emulated in a C# application. Slight Digression Now I know that you have to prioritise Correctness, Performance, Readability, and that C# by …

public, private & new: C# visibility scope explained

I wanted to go over the visibility modifiers in C#. There are a few, it’s not as simple as just public or private. Let’s go through some scenarios and get our heads around what we can use, when and why. I couldn’t think of a good term to group the concepts of methods, constructors, and classes, so I …