本文整理汇总了C#中System.Int16类的典型用法代码示例。如果您正苦于以下问题:C# Int16类的具体用法?C# Int16怎么用?C# Int16使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Int16类属于System命名空间,在下文中一共展示了Int16类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: listOnMonth
private static List<MonthOfTheYear> listOnMonth(Int16 pInit, Int16 pFinish)
{
List<MonthOfTheYear> lstMeses = new List<MonthOfTheYear>();
List<MonthOfTheYear> allMonths = new List<MonthOfTheYear>();
Int16 init, finish;
allMonths = putOnMonth();
if (pInit < 1)
init = 1;
else if (pInit > 12)
init = 12;
else
init = pInit;
//************************************************************
if (pFinish < 1 || pFinish > 12)
finish = 12;
else if (pInit > pFinish)
finish = pInit;
else
finish = pFinish;
//************************************************************
foreach (MonthOfTheYear mes in allMonths)
{
if (mes.Num >= init && mes.Num <= finish)
lstMeses.Add(mes);
}
return lstMeses;
}
示例2: getMpdata
public void getMpdata(Int16 constituencyId)
{
try
{
DataTable dt = new DataTable();
dt = mpdetailsbal.getData(constituencyId); /** empid fetch throw ***/
imgMpProfile.ImageUrl = dt.Rows[0]["profilePic"].ToString();
lblname.Text = dt.Rows[0]["firstName"].ToString() + " " + dt.Rows[0]["middleName"].ToString() + " " + dt.Rows[0]["lastName"].ToString();
lblconstituency.Text = dt.Rows[0]["constituency"].ToString();
lblparty.Text = dt.Rows[0]["partyName"].ToString() + "(" + dt.Rows[0]["Abbreviation"].ToString() + ")";
lblmail.Text = dt.Rows[0]["email"].ToString();
lblcntct.Text = dt.Rows[0]["mobile"].ToString();
lbleducational_q.Text = dt.Rows[0]["qualification"].ToString();
lblprofession.Text = dt.Rows[0]["profession"].ToString();
lblp_address.Text = dt.Rows[0]["permanentAddress"].ToString() + ", " + dt.Rows[0][12].ToString() + ", " + dt.Rows[0][13].ToString();
lblpresent_address.Text = dt.Rows[0]["currentAddress"].ToString() + ", " + dt.Rows[0][15].ToString() + ", " + dt.Rows[0][16].ToString();
mpidval = Int64.Parse(dt.Rows[0]["mpId"].ToString());
//DataTable numDt = new DataTable();
//numDt = issuesbal.Issues_Numbers(Convert.ToInt64(dt.Rows[0]["mpId"]));
//lblissuesno.Text = numDt.Rows[0][0].ToString();
//lblsolvedissuesno.Text = numDt.Rows[0][1].ToString();
}
catch
{
throw;
}
finally
{
}
}
示例3: SetSlotPacket
public SetSlotPacket(sbyte windowId = 0, Int16 slot = 0, object slotData = null)
: base(PacketType.SetSlot)
{
WindowID = windowId;
Slot = slot;
SlotData = slotData;
}
示例4: MetaData
public MetaData(byte key, string fileName, Int16 fileSize,
byte parity)
: base(key, parity)
{
FileName = fileName;
ProgramSize = fileSize;
}
示例5: Trip
public Trip(BinaryReader byteFile)
{
this.Time = byteFile.ReadInt64();
this.TimeDT = new DateTime(this.Time);
this.Comment = byteFile.ReadString();
this.declination = byteFile.ReadInt16();
}
示例6: Device
public Device(
Boolean _dhcp_
,Boolean _enabled_
,Boolean _allowStorage_
,Boolean _acceptKOPR_
,Boolean _allowRetrieve_
,Boolean _allowQuery_
,Boolean _allowAutoRoute_
,Int16 _throttleMaxConnections_
,DateTime _lastAccessedTime_
,DeviceTypeEnum _deviceTypeEnum_
,ServerEntityKey _serverPartitionKey_
,String _aeTitle_
,Int32 _port_
,String _description_
,String _ipAddress_
):base("Device")
{
Dhcp = _dhcp_;
Enabled = _enabled_;
AllowStorage = _allowStorage_;
AcceptKOPR = _acceptKOPR_;
AllowRetrieve = _allowRetrieve_;
AllowQuery = _allowQuery_;
AllowAutoRoute = _allowAutoRoute_;
ThrottleMaxConnections = _throttleMaxConnections_;
LastAccessedTime = _lastAccessedTime_;
DeviceTypeEnum = _deviceTypeEnum_;
ServerPartitionKey = _serverPartitionKey_;
AeTitle = _aeTitle_;
Port = _port_;
Description = _description_;
IpAddress = _ipAddress_;
}
示例7: Image
public Image(Int16 minute, string file_name, string date_taken, Int16 method)
{
this.minute = minute;
this.file_name = file_name;
this.date_taken = date_taken;
this.method = method;
}
示例8: FindTServer
/// <summary>
/// Find Player by Id
/// </summary>
public TServer FindTServer(Int16 Id)
{
TServer player;
if (this.serverList.TryGetValue(Id, out player))
return player;
return null;
}
示例9: Caesar
public static string Caesar(this string source, Int16 shift)
{
var maxChar = Convert.ToInt32(char.MaxValue);
var minChar = Convert.ToInt32(char.MinValue);
var buffer = source.ToCharArray();
for (var i = 0; i < buffer.Length; i++)
{
var shifted = Convert.ToInt32(buffer[i]) + shift;
if (shifted > maxChar)
{
shifted -= maxChar;
}
else if (shifted < minChar)
{
shifted += maxChar;
}
buffer[i] = Convert.ToChar(shifted);
}
var result = new string(buffer);
return result;
}
示例10: Flow
/// <summary>
/// Metoda szukająca maksymalny przepływ.
/// </summary>
/// <param name="start">Punkt początkowy przepływu</param>
/// <param name="stop">Punkt końcowy przepływu</param>
/// <param name="_matrix">Graf na ktorym operujemy przedstawiony w postaci macierzy incydencji</param>
public virtual void Flow(int start, int stop, Int16?[][] _matrix)
{
setFlowMatrix(_matrix);
flow_val = 0;
//wyjatkowy przypadek
if (start == stop) {
raport_str.Append("Start == Stop: przepływ dowolny\n");
return;
}
//ścieżkę reprezentujemy jako sekwencyjną listę liczb
//które określają wierzchołki przez które trzeba przejść
List<int> path = null;
//jeśli jest ścieżka o długości większej niż 0
while((path = findPath(start,stop)).Count > 0){
int min = findMinFlow(path);
flow_val += min;
minimize(path, min);
}
raport_str.Append("Maksymalny przepływ wg. Forda i Fulkersona to " + flow_val + "\n");
}
示例11: load_districts
//district
public DataTable load_districts(Int16 stateId)
{
try
{
if (care.State == ConnectionState.Closed)
{
care.Open();
}
adapt = new SqlDataAdapter("fetchDist", care);
adapt.SelectCommand.CommandType = CommandType.StoredProcedure;
adapt.SelectCommand.Parameters.AddWithValue("@stateId", stateId);
DataSet ds = new DataSet();
adapt.Fill(ds, "tblDist");
adapt.Dispose();
return ds.Tables["tblDist"];
}
catch
{
throw;
}
finally
{
care.Close();
}
}
示例12: ReadGasCard
public int ReadGasCard(short com, int baud, ref string kh, ref int ql, ref decimal money, ref short cs, ref Int16 bkcs, ref string yhh)
{
byte[] cardNO = new byte[100];
byte[] kmm = new byte[100];
byte[] dqdm = new byte[100];
byte[] yhh1 = System.Text.Encoding.GetEncoding(1252).GetBytes(yhh);
byte[] sqrq = new byte[100];
byte[] sxrq = new byte[100];
byte[] sxbj = new byte[100];
byte[] tm = new byte[100];
short klx = 0;
short kzt = 0;
int ljgql = 0;
int ljyql = 0;
int syql = 0;
int bjql = 0;
int czsx = 0;
int tzed = 0;
int oldprice = 0;
int newprice = 0;
short Nbkcs = bkcs;
int ret = StaticReadGasCard(0, baud, kmm, ref klx, ref kzt, cardNO, dqdm, yhh1, tm,
ref ql, ref cs, ref ljgql, ref Nbkcs, ref ljyql, ref syql, ref bjql, ref czsx,
ref tzed, sqrq, ref oldprice, ref newprice, sxrq, sxbj);
Log.Debug("read card ret=" + ret);
//卡号转换成字符串
cardNO[8] = 0;
kh = Encoding.ASCII.GetString(cardNO, 0, 8);
return ret;
}
示例13: CreateArtifact
/// <summary>
///
/// </summary>
/// <param name="typeCodeValue"></param>
/// <param name="endpointIndexValue"></param>
/// <param name="sourceIdHash"></param>
/// <param name="messageHandle"></param>
/// <returns>A Base64 encoded string containing the artifact</returns>
public static string CreateArtifact(Int16 typeCodeValue, Int16 endpointIndexValue, byte[] sourceIdHash, byte[] messageHandle)
{
if (sourceIdHash.Length != SourceIdLength)
throw new ArgumentException(
string.Format(argumentLengthErrorFmt, sourceIdHash.Length,SourceIdLength), "sourceIdHash");
if (messageHandle.Length != MessageHandleLength)
throw new ArgumentException(
string.Format(argumentLengthErrorFmt, messageHandle.Length, MessageHandleLength), "messageHandle");
byte[] typeCode = new byte[2];
typeCode[0] = (byte)(typeCodeValue >> 8);
typeCode[1] = (byte)(typeCodeValue);
byte[] endpointIndex = new byte[2];
endpointIndex[0] = (byte)(endpointIndexValue >> 8);
endpointIndex[1] = (byte)(endpointIndexValue);
byte[] result = new byte[2 + 2 + SourceIdLength + MessageHandleLength];
typeCode.CopyTo(result, 0);
endpointIndex.CopyTo(result, 2);
sourceIdHash.CopyTo(result, 4);
messageHandle.CopyTo(result, 4 + SourceIdLength);
return Convert.ToBase64String(result);
}
示例14: Int16Tests
public void Int16Tests(Int16 number, Byte[] expectedBytes)
{
var buffer = new byte[2];
var encoder = new KafkaEncoder(buffer);
encoder.Write(number);
Assert.That(buffer, Is.EqualTo(expectedBytes));
}
示例15: ParseArtifact
/// <summary>
///
/// </summary>
/// <param name="artifact"></param>
/// <param name="typeCodeValue"></param>
/// <param name="endpointIndex"></param>
/// <param name="sourceIdHash"></param>
/// <param name="messageHandle"></param>
public static void ParseArtifact(string artifact, ref Int16 typeCodeValue, ref Int16 endpointIndex, ref byte[] sourceIdHash, ref byte[] messageHandle)
{
if (sourceIdHash.Length != SourceIdLength)
throw new ArgumentException(
string.Format(argumentLengthErrorFmt, sourceIdHash.Length, SourceIdLength), "sourceIdHash");
if (messageHandle.Length != MessageHandleLength)
throw new ArgumentException(
string.Format(argumentLengthErrorFmt, messageHandle.Length, MessageHandleLength), "messageHandle");
byte[] bytes = Convert.FromBase64String(artifact);
if (bytes.Length != artifactLength)
throw new ArgumentException("Unexpected artifact length", "artifact");
typeCodeValue = (Int16)(bytes[0] << 8 | bytes[1]);
endpointIndex = (Int16)(bytes[2] << 8 | bytes[3]);
int index = 4;
for(int i = 0; i < SourceIdLength; i++)
{
sourceIdHash[i] = bytes[i + index];
}
index += SourceIdLength;
for (int i = 0; i < MessageHandleLength; i++)
{
messageHandle[i] = bytes[i + index];
}
}