This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MySqlConnection conn = new MySqlConnection(connStr); | |
conn.Open(); | |
// no job until expired wait_timeout... default timeout is 28800 seconds. | |
conn.Ping(); | |
if (conn.State == System.Data.ConnectionState.Closed) | |
conn.Open(); | |
// Then you can use connection! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string test1 = "word1:word2"; | |
string[] test1Result = test1.Split(':'); | |
foreach (string s in test1Result) | |
{ | |
Console.WriteLine(s); | |
} | |
string test2 = "word1<>word2"; | |
string[] test2Result = System.Text.RegularExpressions.Regex.Split(test2, "<>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reflection; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Threading; | |
using System.Diagnostics; | |
namespace MyProgram | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace DllLibrary | |
{ | |
public class MyClass | |
{ | |
public static int ReturnInputValue(byte[] test) | |
{ | |
return BitConverter.ToInt32(test, 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ServiceProcess; | |
namespace WindowsService2 | |
{ | |
public partial class Service1 : ServiceBase | |
{ | |
public Service1() | |
{ | |
InitializeComponent(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Security.Cryptography; | |
namespace ConsoleApplication32 | |
{ | |
class Program | |
{ | |
static HashSet<string> set = new HashSet<string>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.SqlClient; | |
using System.Data.SqlTypes; | |
using Microsoft.SqlServer.Server; | |
namespace SqlServerProject5 | |
{ | |
public class Class1 | |
{ | |
[SqlFunction] | |
public static SqlInt32 GetSquare(SqlInt32 param) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
string text = "In formal language theory and computer programming, " + | |
"string concatenation is the operation of joining two character strings end-to-end. " + | |
"For example, the concatenation of 'snow' and 'ball' is 'snowball'. " + | |
"In some but not all formalizations of concatenation theory, " + | |
"also called string theory, string concatenation is a primitive notion."; | |
Console.WriteLine(text); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
// To run this program, provide a command line string. | |
// In Visual Studio, see Project > Properties > Debug. | |
string userName = args[0]; | |
string date = DateTime.Today.ToShortDateString(); | |
// Use the + and += operators for one-time concatenations. | |
string str = "Hello " + userName + ". Today is " + date + "."; | |
System.Console.WriteLine(str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringBuilderTest | |
{ | |
static void Main() | |
{ | |
string text = null; | |
// Use StringBuilder for concatenation in tight loops. | |
System.Text.StringBuilder sb = new System.Text.StringBuilder(); | |
for (int i = 0; i < 100; i++) | |
{ |
OlderNewer