本文整理汇总了C#中System.Int32类的典型用法代码示例。如果您正苦于以下问题:C# System.Int32类的具体用法?C# System.Int32怎么用?C# System.Int32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Int32类属于命名空间,在下文中一共展示了System.Int32类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public override int Deserialize(System.Byte[] serialized, int startIndex)
{
int curIndex = startIndex;
data = BitConverter.ToInt32(serialized, curIndex);
curIndex += BitConverter.GetBytes(data).Length;
return (curIndex - startIndex);
}
示例2: IDTest
public void IDTest()
{
var value = new System.Int32();
var target = new EnglishSentences();
target.ID = value;
Assert.AreEqual(value, target.ID);
}
示例3: Abstract1
/// <summary>Initializes a new instance of the Abstract1 class.</summary>
protected Abstract1(
System.UInt32 identity,
System.Int32 abstract1Field1,
System.Int32 abstract1Field2,
ImmutableObjectGraph.Optional<bool> skipValidation = default(ImmutableObjectGraph.Optional<bool>))
{
this.identity = identity;
this.abstract1Field1 = abstract1Field1;
this.abstract1Field2 = abstract1Field2;
}
示例4: A
/// <summary>Initializes a new instance of the A class.</summary>
protected A(
System.UInt32 identity,
System.Int32 field1,
ImmutableObjectGraph.Optional<bool> skipValidation = default(ImmutableObjectGraph.Optional<bool>))
{
this.identity = identity;
this.field1 = field1;
if (!skipValidation.Value) {
this.Validate();
}
}
示例5: Fruit
/// <summary>Initializes a new instance of the Fruit class.</summary>
protected Fruit(
System.UInt32 identity,
System.String color,
System.Int32 skinThickness,
ImmutableObjectGraph.Optional<bool> skipValidation = default(ImmutableObjectGraph.Optional<bool>))
{
this.identity = identity;
this.color = color;
this.skinThickness = skinThickness;
if (!skipValidation.Value) {
this.Validate();
}
}
示例7: Enroques
//----------------------------------------------------------------------------------------
public static int Enroques(cPosicion pos, cMov[] mlist, int mPos, color us, cInfoJaque ci, enroque Cr, bool Checks, bool Chess960)
{
bool KingSide = (Cr==cEnroque.OO_BLANCAS||Cr==cEnroque.OO_NEGRAS);
if(pos.CanNotEnroque(Cr)||0==pos.PosibleEnrocar(Cr))
return mPos;
sq kfrom = pos.GetRey(us);
sq rfrom = pos.CasillaTorreEnroque(Cr);
sq kto = cTypes.CasillaProxima(us, KingSide ? cCasilla.G1 : cCasilla.C1);
bitbrd enemies = pos.PiezasColor(cTypes.Contrario(us));
sq K = Chess960 ? kto>kfrom ? cCasilla.OESTE : cCasilla.ESTE : KingSide ? cCasilla.OESTE : cCasilla.ESTE;
for(sq s = kto; s!=kfrom; s+=K)
if((pos.AtaquesA(s)&enemies)!=0)
return mPos;
if(Chess960&&(cBitBoard.AtaquesPieza(kto, pos.Piezas()^cBitBoard.m_nCasillas[rfrom], cPieza.TORRE)&pos.PiezasColor(cTypes.Contrario(us), cPieza.TORRE, cPieza.DAMA))!=0)
return mPos;
mov m = cTypes.CreaMov(kfrom, rfrom, cMovType.ENROQUE, cPieza.CABALLO);
if(Checks&&!pos.IsJaque(m, ci))
return mPos;
mlist[mPos++].m=m;
return mPos;
}
示例8: Texture
public Texture(PlatformTexture texture, int sourceWidth, int sourceHeight, int left, int right, int top, int bottom, bool isTransparent)
{
Debug.Assert(sourceWidth > 0);
Debug.Assert(sourceHeight > 0);
Debug.Assert(left >= 0 && left <= sourceWidth);
Debug.Assert(right >= 0 && right <= sourceWidth);
Debug.Assert(right >= left);
Debug.Assert(top >= 0 && top <= sourceHeight);
Debug.Assert(bottom >= 0 && bottom <= sourceHeight);
Debug.Assert(bottom >= top);
this.PlatformTexture = texture;
this.SourceWidth = sourceWidth;
this.SourceHeight = sourceHeight;
this.Width = right - left;
this.Height = bottom - top;
this.Left = (float)left / sourceWidth;
this.Right = (float)right / sourceWidth;
this.Top = (float)top / sourceHeight;
this.Bottom = (float)bottom / sourceHeight;
this.IsTransparent = isTransparent;
}
示例9: Capturas
//----------------------------------------------------------------------------------------
public static int Capturas(cPosicion pos, cMov[] mlist, int mPos, type Type)
{
color us = pos.ColorMueve();
bitbrd target = Type==cMovType.CAPTURES ? pos.PiezasColor(cTypes.Contrario(us))
: Type==cMovType.QUIETS ? ~pos.Piezas()
: Type==cMovType.NON_EVASIONS ? ~pos.PiezasColor(us) : 0;
return us==cColor.BLANCO ? ToDO(pos, mlist, mPos, target, cColor.BLANCO, Type, null)
: ToDO(pos, mlist, mPos, target, cColor.NEGRO, Type, null);
}
示例10: GetResult
private string GetResult(Number number)
{
if (number < 0)
{
number = -number;
}
if (number < 4 || number > 10000000)
{
return null;
}
var factors = new List<Number>();
var bound = number / 2;
for (Number i = 2; i <= bound; i++)
{
if (i > 3)
{
// skip further even divisors
i++;
}
while (number % i == 0)
{
number /= i;
factors.Add(i);
}
if (number == 1)
{
break;
}
}
if (number != 1)
{
return "Prime number.";
}
var sb = new StringBuilder();
sb.Append("Factors: ");
sb.Append(string.Join(" ", factors));
return sb.ToString();
}
示例11: AddInstance
// TODO: this parameter won't be optional
public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f)
{
Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix);
MyBuilderInstanceData builderInstanceData;
if (!m_instanceParts.TryGetValue(model, out builderInstanceData))
{
builderInstanceData = new MyBuilderInstanceData();
builderInstanceData.Model = model;
m_instanceParts.Add(model, builderInstanceData);
}
//if (bones == null)
//{
// builderInstanceData.InstanceData.Add(new MyCubeInstanceData()
// {
// ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
// EnableSkinning = false,
// LocalMatrix = localMatrix
// });
//}
//else
//{
// var cubeInstance = new MyCubeInstanceData()
// {
// ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
// EnableSkinning = true,
// LocalMatrix = localMatrix,
// };
// cubeInstance.BoneRange = gridSize;
// for (int i = 0; i < 9; i++)
// {
// cubeInstance[i] = bones[i];
// }
// builderInstanceData.InstanceData.Add(cubeInstance);
//}
builderInstanceData.InstanceData.Add(new MyInstanceData()
{
ColorMaskHSV = new VRageMath.PackedVector.HalfVector4(new Vector4(MyPlayer.SelectedColor, 0)),
LocalMatrix = localMatrix
});
}
示例12: AddInstance
// TODO: this parameter won't be optional
public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f)
{
Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix);
MyBuilderInstanceData builderInstanceData;
if (!m_instanceParts.TryGetValue(model, out builderInstanceData))
{
builderInstanceData = new MyBuilderInstanceData();
builderInstanceData.Model = model;
m_instanceParts.Add(model, builderInstanceData);
}
if (bones == null)
{
builderInstanceData.InstanceData.Add(new MyCubeInstanceData()
{
ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
EnableSkinning = false,
LocalMatrix = localMatrix
});
}
else
{
var cubeInstance = new MyCubeInstanceData()
{
ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
EnableSkinning = true,
LocalMatrix = localMatrix,
};
cubeInstance.BoneRange = gridSize;
for (int i = 0; i < 9; i++)
{
cubeInstance[i] = bones[i];
}
builderInstanceData.InstanceData.Add(cubeInstance);
}
m_cubeBuilderAABB = m_cubeBuilderAABB.Include(
new BoundingBox(new Vector3(-MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large)),
new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large))).Transform(localMatrix));
}
示例13: Scan
public static bool Scan(this ITdfaSimulation automaton, int[] input, out State action)
{
State state = automaton.Start;
State? acceptingState = null;
foreach (var item in input)
{
State nextState;
if (automaton.TryNext(state, item, out nextState))
{
state = nextState;
}
else if (automaton.Tunnel(state, out nextState))
{
state = nextState;
}
else
{
break;
}
if (automaton.IsAccepting(state))
{
acceptingState = state;
}
}
if (!acceptingState.HasValue)
{
action = -1;
return false;
}
var optAction = automaton.GetAction(acceptingState.Value);
action = optAction.GetValueOrDefault(-1);
return true;
}
示例14:
static extern void gtk_paint_resize_grip (
GtkStylePointer style,
GdkWindowPointer window,
GtkStateType state_type,
ref GdkRectangle area,
GtkWidgetPointer widget,
string detail,
GdkWindowEdge edge,
gint x,
gint y,
gint width,
gint height);
示例15: GdkRectangle
public GdkRectangle (Rectangle value)
{
x = value.X;
y = value.Y;
width = value.Width;
height = value.Height;
}