Explore

Explore snippets

Discover reusable code snippets, examples, fixes, and ideas shared by developers, students, and teams.

Public snippets by CodShot user
Clear
Popular tags: #beadando
3 public snippets
Open
C#
Public

Singleton Pattern in C#

Defines a singleton class with a static instance method ensuring a single object and a method returning a fixed integer.

C# Preview
namespace HF10
{
    internal class S : ISize
    {
        private static S instance = null;

        private S()
        {
        }

        public static S Instance()
        {
            if (instance == null)
            {
#beadando
CodShot user
CodShot user
Updated: 2026-05-05 20:20
Public snippets
1 #34
Open
C#
Public

Center.cs

C# Preview
using System;
using System.Collections.Generic;

namespace HF07
{
    internal class Center
    {
        private List<Bank> bankok;

        public Center(List<Bank> bankok)
        {
            this.bankok = bankok;
        }
CodShot user
CodShot user
Updated: 2026-04-08 15:52
Public snippets
1 #16
Open
C#
Public

ATM.cs

C# Preview
using System;

namespace HF07
{
    internal class ATM
    {
        private string location;
        private Center center;

        public ATM(string location, Center center)
        {
            this.location = location;
            this.center = center;
CodShot user
CodShot user
Updated: 2026-04-08 15:47
Public snippets
1 #13
CodShot AI Help
Ask about CodShot features, plans, workspace, AI limits, referrals, and public help topics.
Hi! I can help you understand how CodShot works. What would you like to know?
For account-specific or sensitive issues, please open a support ticket. Open support