Ist die Verwendung von statischen Klassen in C# dieselbe wie prozedurale Programmierkompiler?C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Ist die Verwendung von statischen Klassen in C# dieselbe wie prozedurale Programmierkompiler?

Post by Anonymous »

im Grunde verwende ich Einheit und es wurde C#verwendet. Ich möchte prozedural programmieren. Kann ich dies mit statischen Namespaces und statischen Klassen nachahmen, damit ich die statischen Namespaces als "Header -Dateien" verwenden kann, damit ich nicht eine Reihe von Singletons instanziieren muss. Wie ist diese Leistung weise?

Code: Select all

namespace Balls
{
public static Ball [] balls;

public static class Balls
{
public static void UpdateBalls (){}
}
}
< /code>

Eine andere Datei: < /p>

using static Balls;

namespace Player
{
public static class Player
{
public static bool PlayerAlive;
public static Vector3 position;

public static void UpdatePlayer ()
{
for (int i=0; i

Eine andere Datei: < /p>

using static Balls;
using static Player;

namespace Main
{
public static class Main
{
public static void MainUpdate ()
{
if (PlayerAlive)
{
UpdateBalls ();
UpdatePlayer ();
}
}
}
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post