Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Visual Studio 2022 クラスダイアグラムでサクッとクラス図を作る

0
Posted at

はじめに

Visual Studio 2022 のクラスダイアグラムでサクッとクラス図を作ってみます。

改訂履歴

  • 2026/07/27 : 初版公開。

本文

1. 環境

  • .NET 8.0
  • Visual Studio Community 2022

2. 手順

2-1. 機能のインストール

Visual Studio Installer でクラスデザイナーをインストールします。

2-2. クラスダイアグラムの生成

とりあえずサンプルクラスを作成します。

Animal.cs
namespace ClassDiagramExample;

internal class Animal
{
    public string Name { get; set; } = string.Empty;

    public void Eat()
    {
        Console.WriteLine("食べる");
    }

    public void Sleep()
    {
        Console.WriteLine("寝る");
    }
}
IBarkable.cs
namespace ClassDiagramExample;

internal interface IBarkable
{
    void Bark();
}
Dog.cs
namespace ClassDiagramExample;

internal class Dog : Animal, IBarkable
{
    public void Bark()
    {
        Console.WriteLine("吠える");
    }
}

「新しい項目の追加」で、プロジェクトにクラスダイアグラムを追加します。

クラスを選んで、クラスダイアグラムにドラッグ・アンド・ドロップします。

生成されました。

右クリックメニューから微調整を繰り返すと、以下になります。ちなみに展開は Ctrl + A で全選択して、数字キーの + でまとめて操作できます。

おわりに

右クリックメニューから PNG 形式で出力できます。決してリッチな機能とは言えないと思いますが、とりあえず詳細設計書を埋めるのに使えるかも(ちゃんとやれ)。

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?