If you look up the docs for how assignment works you will see the explanation that a = b = c
is evaluated like a = (b = c)
. The key is this line from the docs: "The result of a simple assignment expression is the value assigned to the left operand." In this case the result of the (b = c)
expression is the value in c
which is "John". This then assigns "John" into a
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System; | |
using static System.Diagnostics.Debug; | |
namespace Example | |
{ | |
[TestClass] | |
public class ExceptionFiltersFizzBuzz | |
{ | |
[TestMethod] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "C:\Dev\microsoft\packages\Newtonsoft.Json.7.0.1\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll" | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
public class Spell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ControlTemplate TargetType="{x:Type local:MyDrawerHost}"> | |
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> | |
<VisualStateManager.VisualStateGroups> | |
<VisualStateGroup x:Name="LeftDrawer"> | |
<VisualStateGroup.Transitions> | |
<VisualTransition From="LeftDrawerClosed" To="LeftDrawerOpen"> | |
<Storyboard> | |
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="PART_LeftDrawer"> | |
<EasingThicknessKeyFrame Value="0" KeyTime="0:0:0.4"> | |
<EasingThicknessKeyFrame.EasingFunction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CompositeCommand : ICommand | |
{ | |
public event EventHandler CanExecuteChanged; | |
private readonly IList<ICommand> _Commands; | |
public CompositeCommand(IList<ICommand> commands) | |
{ | |
if (commands == null) throw new ArgumentNullException(nameof(commands)); | |
_Commands = new List<ICommand>(commands); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="Example.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes" | |
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" | |
mc:Ignorable="d" | |
Background="{DynamicResource MaterialDesignPaper}" | |
Style="{StaticResource MaterialDesignWindow}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Main() | |
{ | |
var obj = new Printer(); | |
IFizz fizz = obj; | |
IBuzz buzz = obj; | |
IFizzBuzz fizzBuzz = obj; | |
for (int i = 0; i < 100; i++) | |
{ | |
if (i % 15 == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Service | |
{ | |
public Result<Person> FindPerson(string query) | |
{ | |
try | |
{ | |
Person person = ...; | |
return person ?? Result.NotFound<Person>(); //Not strictly neccisary; the implicit operator will do a null check. | |
} | |
catch (Exception e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/interfaces#interface-implementation-inheritance | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
IFoo @base = new Base(); | |
IFoo derived = new Derived(); | |
Console.WriteLine(@base.Bar()); //=> Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build started, please wait... | |
Build completed. | |
Test run for C:\Dev\unitTest\bin\Debug\netcoreapp2.1\unitTest.dll(.NETCoreApp,Version=v2.1) | |
Microsoft (R) Test Execution Command Line Tool Version 15.8.0 | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Starting test execution, please wait... | |
Total tests: 2. Passed: 2. Failed: 0. Skipped: 0. |
OlderNewer