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


C# Ref类代码示例

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


Ref类属于命名空间,在下文中一共展示了Ref类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NullEqualsRef

 public void NullEqualsRef()
 {
     Ref r = null;
     Ref other = new Ref(null);
     Assert.IsFalse(r == other);
     Assert.IsTrue(r != other);
 }
开发者ID:jeremyrsellars,项目名称:clojure-clr,代码行数:7,代码来源:RefTests.cs

示例2: OlderRefCompareToNewerRef

 public void OlderRefCompareToNewerRef()
 {
     Ref older = new Ref(null);
     Ref newer = new Ref(null);
     Assert.IsTrue(older.CompareTo(newer) < 0);
     Assert.IsTrue(newer.CompareTo(older) > 0);
 }
开发者ID:jeremyrsellars,项目名称:clojure-clr,代码行数:7,代码来源:RefTests.cs

示例3: Place

        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y))
                return false;

            Point result;
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new Conditions.IsSolid()), out result))
                return false;

            result.Y += 2;
            Ref<int> count = new Ref<int>(0);
            WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(count)));
            if (count.Value < 20 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0))
                return false;

            WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.RadialDither(0.0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true)));
            ShapeData data = new ShapeData();
            WorldUtils.Gen(result, new Shapes.Circle(4, 3), Actions.Chain(new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true),
                new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2, byte.MaxValue)));
            WorldUtils.Gen(new Point(result.X, result.Y + 1), new ModShapes.InnerOutline(data, true), Actions.Chain(new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3),
                new Actions.SetTile(59, true, true)));

            structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0);
            return true;
        }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:25,代码来源:HoneyPatchBiome.cs

示例4: PlotCommit

 /// <summary>
 /// Create a new commit.
 /// </summary>
 /// <param name="id">the identity of this commit.</param>
 /// <param name="tags">the tags associated with this commit, null for no tags</param>
 public PlotCommit(AnyObjectId id, Ref[] tags)
     : base(id)
 {
     this.refs = tags;
     passingLanes = NO_LANES;
     children = NO_CHILDREN;
 }
开发者ID:ermshiperete,项目名称:GitSharp,代码行数:12,代码来源:PlotCommit.cs

示例5: Build

        public EmitSyntax Build(EmitSyntax emit)
        {
            int rows = table.RowCount;
            int columns = table.ColumnCount;

            Ref<Labels> END = emit.Labels.Generate().GetRef();
            Ref<Labels>[] labels = new Ref<Labels>[rows];
            for (int i = 0; i != rows; ++i)
            {
                labels[i] = emit.Labels.Generate().GetRef();
            }

            emit
                .Do(LdRow)
                .Switch(labels)
                .Ldc_I4(-1)
                .Br(END)
                ;

            var columnRange = new IntInterval(0, columns - 1);
            var columnFrequency = new UniformIntFrequency(columnRange);
            for (int i = 0; i != rows; ++i)
            {
                var switchEmitter = SwitchGenerator.Sparse(table.GetRow(i), columnRange, columnFrequency);

                emit.Label(labels[i].Def);
                switchEmitter.Build(emit, LdCol, SwitchGenerator.LdValueAction(END));
            }

            return emit .Label(END.Def);
        }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:31,代码来源:ReadOnlyTableGenerator.cs

示例6:

 public MemoryTier this[Ref @ref]
 {
     get
     {
         return this[@ref.AssertNotNull().Sym];
     }
 }
开发者ID:xeno-by,项目名称:conflux,代码行数:7,代码来源:AllocationScheme.cs

示例7: SelectRef

 private void SelectRef(Ref r)
 {
     if (r == null)
         return;
     var obj = r.Target;
     if (obj.IsCommit)
     {
         DisplayCommit(obj as Commit, "Commit history of " + r.Name);
         return;
     }
     else if (obj.IsTag)
     {
         var tag = obj as Tag;
         if (tag.Target == tag) // it sometimes happens to have self referencing tags
         {
             return;
         }
         SelectTag(tag);
         return;
     }
     else if (obj.IsTree)
     {
         // hmm, display somehow
     }
     else if (obj.IsBlob)
     {
         // hmm, display somehow
     }
     else
     {
         Debug.Fail("don't know how to display this object: "+obj.ToString());
     }
 }
开发者ID:qjlee,项目名称:GitSharp.Demo,代码行数:33,代码来源:Browser.xaml.cs

示例8: LabelJumpAction

 public static SwitchGeneratorAction LabelJumpAction(Ref<Labels>[] valueLabels)
 {
     return (EmitSyntax emit, int value) =>
         {
             emit.Br(valueLabels[value]);
         };
 }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:7,代码来源:SwitchGenerator.cs

示例9: ld

        public Emitter ld(Ref @ref)
        {
            var layout = _alloc[@ref];

            var lt_slot = layout as SlotLayout;
            if (lt_slot != null)
            {
                var slot = lt_slot.Slot;
                if (slot is Reg)
                {
                    var reg = (Reg)slot;
                    push(reg);
                }
                else if (slot is Var)
                {
                    var @var = (Var)slot;
                    var type = @var.Type;
                    var reg = def_local(type);
                    _ptx.Add(new ld{ss = @var.Space, type = type, d = reg, a = @var});
                    push(reg);
                }
                else
                {
                    throw AssertionHelper.Fail();
                }
            }
            else
            {
                push(layout);
            }

            return this;
        }
开发者ID:xeno-by,项目名称:conflux,代码行数:33,代码来源:Emitter.Core.cs

示例10: ConcurrentRefUpdateException

		/// <param name="message"></param>
		/// <param name="ref"></param>
		/// <param name="rc"></param>
		public ConcurrentRefUpdateException(string message, Ref @ref, RefUpdate.Result rc
			) : base((rc == null) ? message : message + ". " + MessageFormat.Format(JGitText
			.Get().refUpdateReturnCodeWas, rc))
		{
			this.rc = rc;
			[email protected] = @ref;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:ConcurrentRefUpdateException.cs

示例11: SerializeRef

 private static JToken SerializeRef(Ref reference)
 {
     var result = new JObject();
     result["$type"] = "ref";
     result["value"] = new JArray(reference.AsRef().Select(SerializationHelper.SerializeItem).ToList());
     return result;
 }
开发者ID:darcy-buttrose,项目名称:typescript-webpack,代码行数:7,代码来源:ResponseSerializer.cs

示例12: MemberInfo

 public MemberInfo(Ref memberRef)
 {
     this.memberRef = memberRef;
     oldFullName = memberRef.memberReference.FullName;
     oldName = memberRef.memberReference.Name;
     newName = memberRef.memberReference.Name;
 }
开发者ID:ldh0227,项目名称:de4dot,代码行数:7,代码来源:MemberInfos.cs

示例13: OlderRefNotEqualsNewerRef

 public void OlderRefNotEqualsNewerRef()
 {
     Ref older = new Ref(null);
     Ref newer = new Ref(null);
     Assert.IsFalse(older.Equals(newer));
     Assert.IsFalse(older == newer);
     Assert.IsTrue(older != newer);
 }
开发者ID:jeremyrsellars,项目名称:clojure-clr,代码行数:8,代码来源:RefTests.cs

示例14: Place

        public override bool Place(Point origin, StructureMap structures)
        {
            Ref<int> count1 = new Ref<int>(0);
            Ref<int> count2 = new Ref<int>(0);
            WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new Actions.Scanner(count2), new Modifiers.IsSolid(), new Actions.Scanner(count1)));
            if (count1.Value < count2.Value - 5)
                return false;

            int radius = GenBase._random.Next(6, 10);
            int num1 = GenBase._random.Next(5);
            if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 0))
                return false;

            ShapeData data = new ShapeData();
            WorldUtils.Gen(origin, new Shapes.Slime(radius), Actions.Chain(new Modifiers.Blotches(num1, num1, num1, 1, 0.3).Output(data), 
                new Modifiers.Offset(0, -2), new Modifiers.OnlyTiles(new ushort[1] { 53 }), new Actions.SetTile(397, true, true), 
                new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true)));
            WorldUtils.Gen(origin, new ModShapes.All(data), Actions.Chain(new Actions.ClearTile(false), new Actions.SetLiquid(0, 0), 
                new Actions.SetFrames(true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true)));

            Point result;
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out result))
                return false;

            int j = result.Y - 1;
            bool flag = GenBase._random.Next() % 2 == 0;
            if (GenBase._random.Next() % 10 != 0)
            {
                int num2 = GenBase._random.Next(1, 4);
                int num3 = flag ? 4 : -(radius >> 1);
                for (int index1 = 0; index1 < num2; ++index1)
                {
                    int num4 = GenBase._random.Next(1, 3);
                    for (int index2 = 0; index2 < num4; ++index2)
                        WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 331, false, false, -1, 0);
                }
            }

            int num5 = (radius - 3) * (flag ? -1 : 1);
            if (GenBase._random.Next() % 10 != 0)
                WorldGen.PlaceTile(origin.X + num5, j, 186, false, false, -1, 0);
            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X, j, 215, true, false, -1, 0);
                if (GenBase._tiles[origin.X, j].active() && GenBase._tiles[origin.X, j].type == 215)
                {
                    GenBase._tiles[origin.X, j].frameY += 36;
                    GenBase._tiles[origin.X - 1, j].frameY += 36;
                    GenBase._tiles[origin.X + 1, j].frameY += 36;
                    GenBase._tiles[origin.X, j - 1].frameY += 36;
                    GenBase._tiles[origin.X - 1, j - 1].frameY += 36;
                    GenBase._tiles[origin.X + 1, j - 1].frameY += 36;
                }
            }

            structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4);
            return true;
        }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:58,代码来源:CampsiteBiome.cs

示例15: LdValueAction

 public static SwitchGeneratorAction LdValueAction(Ref<Labels> END)
 {
     return (EmitSyntax emit, int value) =>
         {
             emit
                 .Ldc_I4(value)
                 .Br(END);
         };
 }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:9,代码来源:SwitchGenerator.cs


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