C# USING SHARED CLASS code example
Example 1: C# USING SHARED CLASS
static private string FileName;
static private int Version;
static public void GenerateVersionedFile()
{
Version += 1;
FileName += "(" + Version.ToString() + ")";
}
Example 2: 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
Example 3: C# USING SHARED CLASS
public class Utilities
{
static public void CreateFile()
{
}
}
Example 4: C# USING SHARED CLASS
Dim utils As Utilities
utils = New Utilities
utils.CreateFile()
Example 5: C# USING SHARED CLASS
Utilities utils;
utils = new Utilities();
utils.CreateFile();
Example 6: C# USING SHARED CLASS
Utilities.CreateFile()
Example 7: C# USING SHARED CLASS
public class Utilities
{
static private string InitialFileName;
static Utilities()
{
InitialFileName = "NewFile" + DateTime.Now;
}
static public void CreateFile()
{
...code using InitialFileName...
}
}