diff --git a/src/en/robust-toolbox/ioc.md b/src/en/robust-toolbox/ioc.md index 4d31c2f10..54a99c936 100644 --- a/src/en/robust-toolbox/ioc.md +++ b/src/en/robust-toolbox/ioc.md @@ -23,27 +23,25 @@ So, **to make a dependency**, you're gonna want two things: an interface, and an ```cs // Content.Server/Example/MyDependency.cs -namespace Content.Server.Example +namespace Content.Server.Example; + +public class MyDependency : IMyDependency { - public class MyDependency : IMyDependency + public void Foo() { - public void Foo() - { - Console.WriteLine("Hello World!"); - } + Console.WriteLine("Hello World!"); } } // Content.Server/Interfaces/Example/IMyDependency.cs -namespace Content.Server.Interfaces.Example +namespace Content.Server.Interfaces.Example; + +public interface IMyDependency { - public interface IMyDependency - { - /// - /// Writes a message to the console. - /// - void Foo(); - } + /// + /// Writes a message to the console. + /// + void Foo(); } // ServerContentIoC.cs @@ -104,4 +102,4 @@ public class MyDependency : IMyDependency, IPostInjectInit } ``` -Field injection can be ran manually by using `IoCManager.InjectDependencies(object)`. It is done automatically for many dynamically instantiated types, such as entity components, entity systems, and anything instantiated via `IDynamicTypeFactory`. \ No newline at end of file +Field injection can be ran manually by using `IoCManager.InjectDependencies(object)`. It is done automatically for many dynamically instantiated types, such as entity components, entity systems, and anything instantiated via `IDynamicTypeFactory`. diff --git a/src/en/ss14-by-example/adding-a-simple-bikehorn.md b/src/en/ss14-by-example/adding-a-simple-bikehorn.md index cca2e575a..71834cc43 100644 --- a/src/en/ss14-by-example/adding-a-simple-bikehorn.md +++ b/src/en/ss14-by-example/adding-a-simple-bikehorn.md @@ -152,12 +152,11 @@ Now let's just make the most basic component possible: ```csharp // Content.Server/Sound/PlaySoundOnUseComponent.cs -namespace Content.Server.Sound +namespace Content.Server.Sound; + +[RegisterComponent] +public sealed partial class PlaySoundOnUseComponent : Component { - [RegisterComponent] - public sealed partial class PlaySoundOnUseComponent : Component - { - } } ``` @@ -189,14 +188,13 @@ In our case, we'll probably want a field called `sound` on our component, which ```csharp // Content.Server/Sound/PlaySoundOnUseComponent.cs -namespace Content.Server.Sound +namespace Content.Server.Sound; + +[RegisterComponent] +public sealed partial class PlaySoundOnUseComponent : Component { - [RegisterComponent] - public sealed partial class PlaySoundOnUseComponent : Component - { - [DataField] - public string Sound = string.Empty; - } + [DataField] + public string Sound = string.Empty; } ```