<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>C# on Sam Debruyn</title><link>https://debruyn.dev/tags/c%23/</link><description>Recent content in C# on Sam Debruyn</description><generator>Hugo</generator><language>en-us</language><copyright>© Copyright Debruyn Consultancy</copyright><lastBuildDate>Sun, 20 Aug 2023 13:15:37 +0200</lastBuildDate><atom:link href="https://debruyn.dev/tags/c%23/index.xml" rel="self" type="application/rss+xml"/><item><title>Optimize memory usage in Xamarin apps</title><link>https://debruyn.dev/2017/optimize-memory-usage-in-xamarin-apps/</link><pubDate>Fri, 02 Jun 2017 16:32:42 +0200</pubDate><guid>https://debruyn.dev/2017/optimize-memory-usage-in-xamarin-apps/</guid><description>&lt;blockquote&gt;
&lt;p&gt;This post has been translated to Russian by &lt;a
 href="https://twitter.com/g0rdan" data-umami-event="outbound_link_click" data-umami-event-url="https://twitter.com/g0rdan" target="_blank" rel="noreferrer noopener"
 &gt;Denis Gordin&lt;/a&gt;
. You can read the Russian version on the Russian website &lt;a
 href="https://habrahabr.ru/post/330854/" data-umami-event="outbound_link_click" data-umami-event-url="https://habrahabr.ru/post/330854/" target="_blank" rel="noreferrer noopener"
 &gt;TechMedia&lt;/a&gt;
. Thanks, Denis!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Xamarin is amazing in how it allows .NET developers to write apps for Android, iOS, MacOS&amp;hellip; in C#. But that amazing capability comes with a prize and even the most simple apps can suffer from high memory usage. Let&amp;rsquo;s find out what happens and what we can do about it. The majority of my examples are based on Xamarin.Android, but you&amp;rsquo;ll quickly notice how this also applies to Xamarin.iOS.&lt;/p&gt;</description></item><item><title>A few common issues with .csproj files in Xamarin apps</title><link>https://debruyn.dev/2017/a-few-common-issues-with-.csproj-files-in-xamarin-apps/</link><pubDate>Thu, 25 May 2017 21:21:16 +0200</pubDate><guid>https://debruyn.dev/2017/a-few-common-issues-with-.csproj-files-in-xamarin-apps/</guid><description>&lt;p&gt;Usually you don&amp;rsquo;t need to manually edit .csproj files for your apps and most developers don&amp;rsquo;t even know what&amp;rsquo;s going on inside this file. However, sometimes you might run into issues related to this file where Visual/Xamarin Studio can&amp;rsquo;t help you.&lt;/p&gt;
&lt;h2 id="the-case-of-the-missing-references"&gt;The case of the missing references&lt;/h2&gt;
&lt;p&gt;At my current client our solution consists of more than 10 projects:&lt;/p&gt;</description></item><item><title>Creating a Xamarin.iOS binding project for dummies</title><link>https://debruyn.dev/2016/creating-a-xamarin.ios-binding-project-for-dummies/</link><pubDate>Mon, 29 Aug 2016 11:10:40 +0200</pubDate><guid>https://debruyn.dev/2016/creating-a-xamarin.ios-binding-project-for-dummies/</guid><description>&lt;h2 id="what-you-need"&gt;What you need&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Experience with Xamarin.iOS&lt;/li&gt;
&lt;li&gt;Xamarin Studio for Mac&lt;/li&gt;
&lt;li&gt;An empty binding project (just create a new project in Xamarin Studio)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="a-very-short-intro-to-objective-c-for-c-developers"&gt;A very short intro to Objective-C for C# developers&lt;/h2&gt;
&lt;p&gt;Oh god, Obj-C, the most incomprehensible programming language in the app dev world. You simply can&amp;rsquo;t create an iOS binding project without some very basic knowledge of Obj-C. So here goes, an intro to Obj-C for C# developers.&lt;/p&gt;</description></item><item><title>Fix common binding errors with MVVM Light on Xamarin</title><link>https://debruyn.dev/2016/fix-common-binding-errors-with-mvvm-light-on-xamarin/</link><pubDate>Tue, 22 Mar 2016 20:02:53 +0100</pubDate><guid>https://debruyn.dev/2016/fix-common-binding-errors-with-mvvm-light-on-xamarin/</guid><description>&lt;p&gt;There isn&amp;rsquo;t much documentation available for &lt;a
 href="http://www.mvvmlight.net/" data-umami-event="outbound_link_click" data-umami-event-url="http://www.mvvmlight.net/" target="_blank" rel="noreferrer noopener"
 &gt;MVVM Light&lt;/a&gt;
 when it comes to Xamarin.Android and Xamarin.iOS. There are several overloads for the &lt;code&gt;SetBinding&lt;/code&gt; method and using the wrong overload causes &lt;code&gt;TargetInvocationException&lt;/code&gt; or &lt;code&gt;TargetException&lt;/code&gt; like &lt;a
 href="http://stackoverflow.com/q/35197870/1592358" data-umami-event="outbound_link_click" data-umami-event-url="http://stackoverflow.com/q/35197870/1592358" target="_blank" rel="noreferrer noopener"
 &gt;this one&lt;/a&gt;
. It&amp;rsquo;s also possible that your bindings don&amp;rsquo;t update anymore after you set one binding using an incorrect syntax.&lt;/p&gt;</description></item><item><title>Dependency injection with Autofac and MVVM Light in Xamarin</title><link>https://debruyn.dev/2016/dependency-injection-with-autofac-and-mvvm-light-in-xamarin/</link><pubDate>Mon, 22 Feb 2016 18:59:37 +0100</pubDate><guid>https://debruyn.dev/2016/dependency-injection-with-autofac-and-mvvm-light-in-xamarin/</guid><description>&lt;h2 id="you-gotta-have-mvvm"&gt;You gotta have MVVM&lt;/h2&gt;
&lt;p&gt;A developer and his tools are inseparable. We all like &lt;a
 href="https://sites.google.com/site/unclebobconsultingllc/getting-a-solid-start" data-umami-event="outbound_link_click" data-umami-event-url="https://sites.google.com/site/unclebobconsultingllc/getting-a-solid-start" target="_blank" rel="noreferrer noopener"
 &gt;SOLID&lt;/a&gt;
 and every (.NET) developer has his or her favourite dependency injection tool. There is &lt;a
 href="http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx" data-umami-event="outbound_link_click" data-umami-event-url="http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx" target="_blank" rel="noreferrer noopener"
 &gt;a lot&lt;/a&gt;
 to choose from. I like Autofac because of the way it handles modules, the lifetime of a type and how it registers types.&lt;/p&gt;</description></item><item><title>Queue for MessageDialog in Windows RT</title><link>https://debruyn.dev/2014/queue-for-messagedialog-in-windows-rt/</link><pubDate>Wed, 20 Aug 2014 00:00:00 +0000</pubDate><guid>https://debruyn.dev/2014/queue-for-messagedialog-in-windows-rt/</guid><description>&lt;p&gt;When I write Windows Store applications, I use MessageDialog a lot.
It&amp;rsquo;s the easiest way to show a quick informative pop-up message or a question to the user.
However, when you tend to use this quite often, you&amp;rsquo;ll probably run into a problem.&lt;/p&gt;
&lt;p&gt;The Windows Runtime framework doesn&amp;rsquo;t allow you to stack MessageDialogs, queue them etc.
So if you need to display one, you&amp;rsquo;ll have to make sure that no other MessageDialog is already open.
Checking if there is an open MessageDialog is not that easy unless you keep references to all the MessageDialogs you create.
There are a few cases in which this would be annoying.&lt;/p&gt;</description></item></channel></rss>