• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Struct类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Struct的典型用法代码示例。如果您正苦于以下问题:C# Struct类的具体用法?C# Struct怎么用?C# Struct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Struct类属于命名空间,在下文中一共展示了Struct类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Main

	public static void Main() {
		
		Struct s = new Struct();
		
		s.x = 1;
		s.y = 2;
		
		System.Console.WriteLine("{0} {1} {2}", s.x, s.y, s.z);
		
		TestS(ref s);
	}	
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:11,代码来源:cs1502-7.cs


示例17: Main

    public static void Main (string[] args) {
        var a = new Struct[10];

        for (var i = 0; i < a.Length; i++)
            a[i] = new Struct {
                I = i
            };

        foreach (var s in a)
            Console.WriteLine(s);
    }
开发者ID:GlennSandoval,项目名称:JSIL,代码行数:11,代码来源:SingleDimStructArrays.cs


示例18: 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");

    if (pointer_reference.overloading(1) != 111) throw new Exception("overload test 1 failed");
    if (pointer_reference.overloading(ss) != 222) throw new Exception("overload test 2 failed");
  }
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:11,代码来源:pointer_reference_runme.cs


示例19: Main

	public static int Main ()
	{
		Struct s = new Struct ("1");
		var t = s.AsyncMethod ();
		if (!Task.WaitAll (new[] { t }, 2000))
			return 1;
		
		if (!t.Result)
			return 2;
		
		return 0;
	}
开发者ID:frje,项目名称:SharpLang,代码行数:12,代码来源:test-async-24.cs


示例20: Inner

 private static void Inner(object i)
 {
     bool b = true;
     char c = 'c';
     object d = 43.0;
     Struct st = new Struct(1);
     if (b)
     {
         string s = "hello world";
         throw new Exception();
     }
 }
开发者ID:southpolenator,项目名称:WinDbgCs,代码行数:12,代码来源:LocalVariables.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# StructuralType类代码示例发布时间:2022-05-24
下一篇:
C# StrokeCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap