本文整理汇总了C#中Ref类的典型用法代码示例。如果您正苦于以下问题:C# Ref类的具体用法?C# Ref怎么用?C# Ref使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ref类属于命名空间,在下文中一共展示了Ref类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: AutomationWindow
public AutomationWindow(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen)
{
this.screen = screen;
this.ScreenManager = ScreenManager;
int WindowWidth = 210;
this.win = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 115 - WindowWidth, 490, WindowWidth, 300);
Rectangle rectangle = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 5 - WindowWidth + 20, 225, WindowWidth - 40, 455);
this.ConstructionSubMenu = new Submenu(ScreenManager, this.win, true);
this.ConstructionSubMenu.AddTab(Localizer.Token(304));
Ref<bool> aeRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoExplore, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoExplore = x);
Checkbox cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 25)), Localizer.Token(305), aeRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 2226;
this.ScoutDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 25 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18));
Ref<bool> acRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoColonize, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoColonize = x);
cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 65)), Localizer.Token(306), acRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 2227;
this.ColonyShipDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 65 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18));
Ref<bool> afRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoFreighters, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoFreighters = x);
cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 105)), Localizer.Token(308), afRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 2229;
this.AutoFreighterDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 105 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18));
this.ConstructorTitle = new Vector2((float)this.win.X + 29, (float)(this.win.Y + 155));
this.ConstructorString = Localizer.Token(6181);
this.ConstructorDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 155 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18));
Ref<bool> abRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoBuild, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoBuild = x);
cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210)), string.Concat(Localizer.Token(307), " Projectors"), abRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 2228;
Ref<bool> acomRef = new Ref<bool>(() => GlobalStats.AutoCombat, (bool x) => GlobalStats.AutoCombat = x);
cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing + 3)), Localizer.Token(2207), acomRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 2230;
Ref<bool> arRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoResearch, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoResearch = x);
cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing * 2 + 6)), Localizer.Token(6136), arRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 7039;
Ref<bool> atRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoTaxes, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoTaxes = x);
cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing * 3 + 9)), Localizer.Token(6138), atRef, Fonts.Arial12Bold);
this.Checkboxes.Add(cb);
cb.Tip_Token = 7040;
this.SetDropDowns();
}
开发者ID:castroev,项目名称:StardriveBlackBox-verRadicalElements-,代码行数:57,代码来源:AutomationWindow.cs
示例17: RefNameResolution
public void RefNameResolution()
{
using (var repo = GetTrashRepository())
{
var master = new Ref(repo, "refs/heads/master");
var previous = new Ref(repo, "refs/heads/master^");
Assert.AreNotEqual(master.Target.Hash, previous.Target.Hash);
Assert.AreEqual((master.Target as Commit).Parent.Hash, previous.Target.Hash);
}
}
开发者ID:spraints,项目名称:GitSharp,代码行数:10,代码来源:RefModelTests.cs
示例18: Checkbox
public Checkbox(Vector2 Position, string text, Ref<bool> connectedTo, SpriteFont Font)
{
this.connectedTo = connectedTo;
this.Text = text;
this.Font = Font;
this.EnclosingRect = new Rectangle((int)Position.X, (int)Position.Y, (int)Font.MeasureString(text).X + 32, Font.LineSpacing + 6);
this.CheckRect = new Rectangle(this.EnclosingRect.X + 15, this.EnclosingRect.Y + this.EnclosingRect.Height / 2 - 5, 10, 10);
this.TextPos = new Vector2((float)(this.CheckRect.X + 15), (float)(this.CheckRect.Y + this.CheckRect.Height / 2 - Font.LineSpacing / 2));
this.CheckPos = new Vector2((float)(this.CheckRect.X + 5) - Fonts.Arial12Bold.MeasureString("x").X / 2f, (float)(this.CheckRect.Y + 4 - Fonts.Arial12Bold.LineSpacing / 2));
}
开发者ID:castroev,项目名称:StardriveBlackBox-verRadicalElements-,代码行数:10,代码来源:Checkbox.cs
示例19: Oscillate
/// <summary>
/// Oscillates around a value. This will animation from
/// startValue > startValue + amount > startValue - amount- > startValue,
/// in a smooth circular motion.
/// </summary>
/// <param name="amount">
/// The maximum amount to oscillate away from the default value.
/// </param>
public static CommandDelegate Oscillate(Ref<float> single, float amount, double duration, CommandEase ease = null)
{
CheckArgumentNonNull(single, "single");
float baseValue = 0f;
return Commands.Sequence(
Commands.Do( () => baseValue = single.Value),
Commands.Duration( t => {
single.Value = baseValue + Mathf.Sin((float) t * 2f * Mathf.PI) * amount;
}, duration, ease)
);
}
开发者ID:darcy-rayner,项目名称:colib,代码行数:19,代码来源:Commands~Animate.cs
示例20: BuildRef
/// <exception cref="System.SqlSyntaxErrorException" />
public virtual Ref BuildRef(Ref
first)
{
for (; lexer.Token() == MySqlToken.KwJoin;)
{
lexer.NextToken();
var temp = Factor();
first = new Join(first, temp);
}
return first;
}
开发者ID:tupunco,项目名称:Tup.Cobar4Net,代码行数:12,代码来源:SoloParser.cs
注:本文中的Ref类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论