C# USING SHARED CLASS

Private Shared FileName As String = String.Empty
Private Shared Version As Integer = 0

Public Shared Sub GenerateVersion()
  Version += 1
  FileName &= "(" & Version.ToString & ")"
End Sub

4.5
4
John Glenn 100 points

                                    Utilities utils;
utils = new Utilities();
utils.CreateFile();

4.5 (4 Votes)
0
3.75
4

                                    public class Utilities
{
  static private string InitialFileName;

  static Utilities()
  {
    InitialFileName = "NewFile" + DateTime.Now;
  }

  static public void CreateFile()
  {
    ...code using InitialFileName...
  }
}

3.75 (4 Votes)
0
4.33
3
Suncheol 85 points

                                    public class Utilities
{
  static public void CreateFile()
  {
  }
}

4.33 (3 Votes)
0
3.75
8
Kathrin 120 points

                                    static private string FileName;
static private int Version;

static public void GenerateVersionedFile()
{
  Version += 1;
  FileName += "(" + Version.ToString() + ")";
}

3.75 (8 Votes)
0
4.5
2
Anna 90 points

                                    Dim utils As Utilities
utils = New Utilities
utils.CreateFile()

4.5 (2 Votes)
0
4
4
Mamster 90 points

                                    Utilities.CreateFile()

4 (5 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source