This Visual Studio extension lets developers quickly create a new C# class (interface, enum, or delegate) file from the clipboard text content, and now also copy the contents of selected files to the clipboard. It's a very useful tool for pasting code from github, gists, code samples, source code generated by LLMs, or quickly copying file contents.
Features
Add Class From Clipboard:
Quickly create a new C# class, interface, enum, or delegate file from clipboard content.
Placement:
In the Project menu
In the Solution Explorer context menu under "Add."
Automatic Class Naming:
Extracts the class name from the clipboard content to name the new file appropriately.
Keyboard Shortcut:
Quickly invoke the command with Ctrl + E, Ctrl + V.
Copy File Contents(New!):
Copy the contents of selected files (or all files in selected projects/folders) to the clipboard, concatenated with line breaks.
Placement:
In the Solution Explorer context menu for files, folders, and projects.
Useful for quickly sharing or reusing code from multiple files.
How to Use
Add Class From Clipboard
Copy valid C# code containing a class (interface, enum, delegate) declaration to your clipboard.
In Visual Studio:
Right-click a folder in Solution Explorer, navigate to Add, and select "Add Class From Clipboard."
Or, open the Project menu and select "Add Class From Clipboard."
The extension will:
Parse the clipboard content.
Extract the class name.
Create a .cs file named after the type in the selected folder.
No file will be created if a valid type name cannot be extracted.
Copy File Contents
In Solution Explorer, select one or more files, folders, or projects.
Right-click and choose Copy File Contents from the context menu.
The contents of all selected files (recursively, for folders/projects) will be copied to the clipboard, separated by blank lines.