本文整理汇总了C#中Struct类的典型用法代码示例。如果您正苦于以下问题:C# Struct类的具体用法?C# Struct怎么用?C# Struct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Struct类属于命名空间,在下文中一共展示了Struct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPosition
Vector3 GetPosition(Struct.DoubleIndex index)
{
Vector3 worldPosition = new Vector3(field.position.x + index.first, 0, field.position.z + index.second);
worldPosition += wallSize / 2;
return worldPosition;
}
示例2: Main
public static int Main()
{
object
o
=
new
Struct
(1);
Struct
s
=
new
Struct
(2);
if
(s.a
!=
2)
return
1;
if
(((Struct)o).a
!=
1)
return
2;
return
0;
}
示例3: Dfs
public static List<Struct.DoubleIndex> Dfs(char [,] map, Struct.DoubleIndex current, Struct.DoubleIndex target, char wall, bool isNew = true)
{
if (isNew) {
currentPath.Clear ();
bestPath = null;
}
currentPath.Insert (0, current.Clone());
if (current.Equals (target) && (bestPath == null || bestPath.Count > currentPath.Count))
bestPath = new List<Struct.DoubleIndex> (currentPath);
if (bestPath != null && bestPath.Count <= currentPath.Count)
return bestPath;
for (int i = 0; i < directionsX.Length; i++) {
current.first += directionsY[i];
current.second += directionsX[i];
if(!currentPath.Contains(current) && CanMove(map, current, wall))
Dfs (map, current, target, wall, false);
current.first -= directionsY[i];
current.second -= directionsX[i];
}
currentPath.RemoveAt (0);
return bestPath;
}
示例4: SurfacesPosition
/// <summary>
/// Initializes a new instance of the PlanePosition class.
/// </summary>
public SurfacesPosition(Struct pos)
{
Throttle = pos.throttle;
Rudder = pos.rudder;
Elevator = pos.elevator;
Aileron = pos.aileron;
}
示例5: RatHatchBrush
public RatHatchBrush(Struct.Pattern pattern)
{
this.pattern=pattern;
this.pen = null;
this.color = pattern.ForeColor;
this.opacity = ((float) this.color.A) / 255f;
}
示例6: GetPrivateValueField
public void GetPrivateValueField()
{
Struct instance = new Struct(privateValueField: 1);
GetMethod result = sut.GetFieldGetter(privateValueField);
Assert.AreEqual(1, result(instance));
}
示例7: GetPrivateValueProperty
public void GetPrivateValueProperty()
{
Struct instance = new Struct(privateValueProperty: 1);
GetMethod result = sut.GetPropertyGetter(privateValueProperty);
Assert.AreEqual(1, result(instance));
}
示例8: Main
public static void Main()
{
Struct s = pointer_reference.get();
if (s.value != 10) throw new Exception("get test failed");
Struct ss = new Struct(20);
pointer_reference.set(ss);
if (Struct.instance.value != 20) throw new Exception("set test failed");
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:9,代码来源:pointer_reference_runme.cs
示例9: GetPublicClassProperty
public void GetPublicClassProperty()
{
object expected = new object();
Struct instance = new Struct { PublicClassProperty = expected };
GetMethod result = sut.GetPropertyGetter(publicClassProperty);
Assert.AreSame(expected, result(instance));
}
示例10: GetPublicClassField
public void GetPublicClassField()
{
object expected = new object();
Struct instance = new Struct { PublicClassField = expected };
GetMethod result = sut.GetFieldGetter(publicClassField);
Assert.AreSame(expected, result(instance));
}
示例11: GetPrivateClassField
public void GetPrivateClassField()
{
object expected = new object();
Struct instance = new Struct(privateClassField: expected);
GetMethod result = sut.GetFieldGetter(privateClassField);
Assert.AreSame(expected, result(instance));
}
示例12: Initialize
private WeakRefTracker _tracker; // storage for weak proxy's
private void Initialize(Struct s) {
_formatString = s._formatString;
_formats = s._formats;
_isStandardized = s._isStandardized;
_isLittleEndian = s._isLittleEndian;
_encodingCount = s._encodingCount;
_encodingSize = s._encodingSize;
_tracker = s._tracker;
}
示例13: Main
public static void Main(string[] args)
{
object foo = new Foo();
NullRefTest containsnullref = new NullRefTest();
Struct s = new Struct(1);
Outer();
GC.KeepAlive(foo);
GC.KeepAlive(containsnullref);
}
示例14: Get
public Struct Get(Struct klass)
{
foreach (Struct st in _mystructs)
{
if (Equals(st.GetType(), klass.GetType()))
{
return st;
}
}
return null;
}
示例15: PlaneControl
/// <summary>
/// Initializes a new instance of the PlaneControl class.
/// </summary>
public PlaneControl(Struct pkt)
{
double ScaleFactor = 1.0;
Roll = (pkt.roll / ScaleFactor) * 100.0;
Pitch = (pkt.pitch / ScaleFactor) * 100.0;
Rudder = (pkt.rudder / ScaleFactor) * 100.0;
// Throttle must be reversed
Throttle = (pkt.throttle / ScaleFactor) * 100.0;
}