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
//************************* | |
// Use Unit Test Generator to click on any method to create a Test Method stub | |
// ************************* | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using CardDispenser; |
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
void IMD1000A.Process(Command cmd, System.IO.Ports.SerialPort _serialPort) | |
{ | |
try | |
{ | |
if (!_serialPort.IsOpen) | |
_serialPort.Open(); | |
LastError = CommandErrorCode.OK; | |
byte[] cmdPacket = cmd.CommandPacket; |
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
<%@ Page Language="vb" %> | |
<script runat=server> | |
public sub CheckID(source as Object, args as ServerValidateEventArgs) | |
args.IsValid = args.Value.substring(0, 1).tolower() <> "a" | |
end sub | |
public sub OnSubmit(source as Object, e as EventArgs) | |
if Page.IsValid then | |
' Now we can perform our transaction. |
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
public class Product { | |
private string modelNumber; | |
public string ModelNumber { | |
get { return modelNumber; } | |
set { modelNumber = value; } | |
} | |
private string modelName; | |
public string ModelNumber { |
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
CREATE DATABASE imoltp | |
GO | |
-------------------------------------- | |
-- create database with a memory-optimized filegroup and a container. | |
ALTER DATABASE imoltp ADD FILEGROUP imoltp_mod CONTAINS MEMORY_OPTIMIZED_DATA | |
ALTER DATABASE imoltp ADD FILE (name='imoltp_mod1', filename='c:\data\imoltp_mod1') TO FILEGROUP imoltp_mod | |
ALTER DATABASE imoltp SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT=ON | |
GO |
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
var add = (function () { | |
var counter = 0; | |
return function () {return counter += 1;} | |
})(); | |
add(); | |
add(); | |
add(); | |
// the counter is now 3 |
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
<head> | |
<script src="http://cdn.extendjs.org/0.2.3/extend.min.js"></script> | |
... | |
</head> | |
//Create MyClass by extending Class. | |
var MyClass = Class.extend(function(){ | |
//Classes can have constructors | |
this.constructor = function(){ |
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
//Define the delegate | |
public delegate int Calculate (int value1, int value2); | |
//a method, that will be assigned to delegate objects having the EXACT signature of the delegate | |
public int add(int value1, int value2) | |
{ | |
return value1 + value2; | |
} | |
//a method, that will be assigned to delegate objects having the EXACT signature of the delegate | |
public int sub( int value1, int value2) |
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
// Another simple way would be to create a class which has a constructor to hold the three strings | |
public class PairedValues | |
{ | |
// These are just simple ways of creating a getter and setter in c# | |
public string value1 { get; set; } | |
public string value2 { get; set; } | |
public string value3 { get; set; } | |
// A constructor which sets all your getters and setters | |
public PairedValues(string Value1, string Value2, string Value3) |
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; | |
class Program | |
{ | |
static Hashtable GetHashtable() | |
{ | |
Hashtable hashtable = new Hashtable(); | |
hashtable.Add(300, "Carrot"); |