C Sharp
24 entriesProjects, notes, and discoveries filed under #c_sharp.
In this collection
Latest updates firstC-Sharp - Access Modifiers
For C# classes and such, there are the access modifiers — plus each respective combination — that can be used:
C-Sharp - Async & Await
In C#, the runtime will automagically handle the async-ness of calling something that is awaitable. That is to say, calling something that you can await won’t necessarily block…
C-Sharp - Configure Awaiter
Using ConfigureAwait(false) means that following code may or may not run on the same thread as before. If there is code that accesses the UI after such a call, it might not be o…
C-Sharp - Convert Collection To List
When a SelectedItemCollection is passed into a RelayCommand delegate, it might be trickier than expected to actually get the values out of the parameter.
C-Sharp - Dynamic Resources in WPF
In this example, I needed to have a color value respected throughout a WPF app whenever it changed. Having the properties defined in a resource dictionary worked initially, but…
C-Sharp - Feature Is Not Supported By The Language
Make sure that the build is being run by a recent enough version of Visual Studio. For example, I ran into this issue on TeamCity when the build stopped working suddenly (still…
C-Sharp - Line Breaks in XAML
Using this special character group will allow breaking up lines of text without having to use Run elements in a TextBlock (or equivalent):
C-Sharp - Moving Up Directories
You can simply use ".." as parameters to Path.GetFullPath to traverse upwards in a directory tree:
C-Sharp - Records
Use a record when it would be useful to be able to compare their properties’ values versus a class, where you would have to implement that comparison logic yourself — the defaul…
C-Sharp - Resource File Reading
If you use the following, you can resolve all of the resources currently loaded by the current assembly:
C-Sharp - VS Blend Timeline Issues
Visual Studio Blend gives various errors like an element in the control not being in the name scope of the storyboard. This leads to issues like not being able to preview the St…
Dependency Injection
The general idea is to create your dependencies ahead of time so that you can pass them along to the classes, objects, etc. that need them. This lets you create real services or…
DotNet - Mismatched Manifest Definition Reference
I ran into this when creating a new project for work, and there was some kind of conflict with the dependencies.
DotNet - Visual Studio Builds Hang
Build starts, but doesn’t appear to move forward at all with the process. You won’t be able to close VS unless you manually kill the VS dev environment process (and the MSBuild.…
Unity - Changing Shader Properties From Scripts
Global properties are used if a shader needs them but the material does not have them defined (for example, if the shader does not expose them in Properties block).
Unity - Cloth Simulation
Add a Cloth component to the GameObject that hosts the mesh renderer you want to make “clothy”. It will automatically swap out the mesh renderer for a Skinned Mesh Renderer. At…
Unity - Coroutines
To exit a coroutine early, you can use yield break;, but if you just want to exit a loop or something, but still allow the coroutine to continue executing beyond the inner scope…
Unity - Using Lerp() Properly
Make sure to actually use time in the correct way to interpolate between two values with Lerp() in Unity, i.e. don’t just throw Time.deltaTime in for the time parameter.
Blazor - General Notes
Generally, the most important thing is whether or not you want things to be handled server-side or not. See documentation on these models.
Movie Analysis
A personal data analysis project on my movie-watching!
Z-Manager
A very old background software management app!
Skeleton Tracking in Unity
Microsoft originally made the Kinect during the Xbox 360 era, which is, unfortunately, a really long time ago at this point. They sold the Kinect and its successors until 2017 a…
A Useful Code Snippet
If I were to pick a single piece or block of code that I would consider to be the most useful to me over all others, I would pick this one: