当前位置: 首页>>代码示例>>C#>>正文


C# Struct类代码示例

本文整理汇总了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;
    }
开发者ID:KipiIInteractive,项目名称:Nightmareman,代码行数:7,代码来源:PathFinder.cs

示例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;
 }
开发者ID:robertmichaelwalsh,项目名称:Multilex,代码行数:29,代码来源:newobj-valuetype.cs

示例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;
    }
开发者ID:KipiIInteractive,项目名称:Nightmareman,代码行数:30,代码来源:ShortestPathAlgorithms.cs

示例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;
 }
开发者ID:ShawInnes,项目名称:P3DHIL,代码行数:10,代码来源:ThrottlePosition.cs

示例5: RatHatchBrush

 public RatHatchBrush(Struct.Pattern pattern)
 {
     this.pattern=pattern;
     this.pen = null;
     this.color = pattern.ForeColor;
     this.opacity = ((float) this.color.A) / 255f;
 }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:7,代码来源:RatHatchBrush.cs

示例6: GetPrivateValueField

        public void GetPrivateValueField()
        {
            Struct instance = new Struct(privateValueField: 1);

            GetMethod result = sut.GetFieldGetter(privateValueField);

            Assert.AreEqual(1, result(instance));
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:8,代码来源:DynamicMethodProviderStructTests.cs

示例7: GetPrivateValueProperty

        public void GetPrivateValueProperty()
        {
            Struct instance = new Struct(privateValueProperty: 1);

            GetMethod result = sut.GetPropertyGetter(privateValueProperty);

            Assert.AreEqual(1, result(instance));
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:8,代码来源:DynamicMethodProviderStructTests.cs

示例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));
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:9,代码来源:DynamicMethodProviderStructTests.cs

示例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));
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:9,代码来源:DynamicMethodProviderStructTests.cs

示例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));
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:9,代码来源:DynamicMethodProviderStructTests.cs

示例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;
            }
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:11,代码来源:_struct.cs

示例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);
    }
开发者ID:southpolenator,项目名称:WinDbgCs,代码行数:10,代码来源:LocalVariables.cs

示例14: Get

 public Struct Get(Struct klass)
 {
     foreach (Struct st in _mystructs)
     {
         if (Equals(st.GetType(), klass.GetType()))
         {
             return st;
         }
     }
     return null;
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:11,代码来源:Header.cs

示例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;
        }
开发者ID:ShawInnes,项目名称:P3DHIL,代码行数:14,代码来源:PlaneControl.cs


注:本文中的Struct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。