本文整理汇总了C#中ParameterCollection类的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection类的具体用法?C# ParameterCollection怎么用?C# ParameterCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterCollection类属于命名空间,在下文中一共展示了ParameterCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckParameters
public ParameterCollection CheckParameters(string[] parameters)
{
ParameterCollection parameterCollection = new ParameterCollection();
switch (parameters.Length)
{
case 0:
parameterCollection.Add("prompt");
return parameterCollection;
case 2:
int difficultyInt;
if (parameters[0].StartsWith("\"") && parameters[0].EndsWith("\"") &&
int.TryParse(parameters[1], out difficultyInt) &&
Enum.IsDefined(typeof(EntryDifficulty), difficultyInt))
{
parameterCollection.Add("immediate");
parameterCollection.Add(parameters[0].Substring(1, parameters[0].Length - 2));
parameterCollection.Add(parameters[1]);
return parameterCollection;
}
break;
}
return null;
}
示例2: LoadContent
protected override async Task LoadContent()
{
await base.LoadContent();
var view = Matrix.LookAtRH(new Vector3(2,2,2), new Vector3(0, 0, 0), Vector3.UnitY);
var projection = Matrix.PerspectiveFovRH((float)Math.PI / 4.0f, (float)GraphicsDevice.BackBuffer.ViewWidth / GraphicsDevice.BackBuffer.ViewHeight, 0.1f, 100.0f);
worldViewProjection = Matrix.Multiply(view, projection);
geometry = GeometricPrimitive.Cube.New(GraphicsDevice);
simpleEffect = new Effect(GraphicsDevice, SpriteEffect.Bytecode);
parameterCollection = new ParameterCollection();
parameterCollectionGroup = new EffectParameterCollectionGroup(GraphicsDevice, simpleEffect, new[] { parameterCollection });
parameterCollection.Set(TexturingKeys.Texture0, UVTexture);
// TODO DisposeBy is not working with device reset
offlineTarget0 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);
offlineTarget1 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);
offlineTarget2 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);
depthBuffer = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.D16_UNorm, TextureFlags.DepthStencil).DisposeBy(this);
width = GraphicsDevice.BackBuffer.ViewWidth;
height = GraphicsDevice.BackBuffer.ViewHeight;
}
示例3: CanAccessNonFilteredParameters
public void CanAccessNonFilteredParameters()
{
var collection =
new ParameterCollection(
new object[] { 10, 20, 30, 40, 50 },
StaticReflection.GetMethodInfo(() => TestMethod(null, null, null, null, null)).GetParameters(),
pi => true);
Assert.AreEqual(5, collection.Count);
CollectionAssert.AreEqual(
new[] { 10, 20, 30, 40, 50 },
collection);
CollectionAssert.AreEqual(
new[] { 50, 20, 40, 30, 10 },
new[] { 4, 1, 3, 2, 0 }.Select(i => collection[i]).ToArray());
CollectionAssert.AreEqual(
new[] { 50, 20, 40, 30, 10 },
new[] { "param5", "param2", "param4", "param3", "param1" }.Select(i => collection[i]).ToArray());
CollectionAssert.AreEqual(
new[] { "param1", "param2", "param3", "param4", "param5" },
Enumerable.Range(0, 5).Select(i => collection.ParameterName(i)).ToArray());
CollectionAssert.AreEqual(
new[] { "param1", "param2", "param3", "param4", "param5" },
Enumerable.Range(0, 5).Select(i => collection.GetParameterInfo(i).Name).ToArray());
}
示例4: ModelComponent
/// <summary>
/// Initializes a new instance of the <see cref="ModelComponent"/> class.
/// </summary>
/// <param name="model">The model.</param>
public ModelComponent(Model model)
{
Parameters = new ParameterCollection();
Model = model;
IsShadowCaster = true;
IsShadowReceiver = true;
}
示例5: Mesh
/// <summary>
/// Initializes a new instance of the <see cref="Mesh" /> class.
/// </summary>
/// <param name="meshDraw">The mesh draw.</param>
/// <param name="parameters">The parameters.</param>
/// <exception cref="System.ArgumentNullException">parameters</exception>
public Mesh(MeshDraw meshDraw, ParameterCollection parameters)
{
if (meshDraw == null) throw new ArgumentNullException("meshDraw");
if (parameters == null) throw new ArgumentNullException("parameters");
Draw = meshDraw;
Parameters = parameters;
}
示例6: Load
public static WikiPage Load(Wiki wiki, string title, string directory)
{
ParameterCollection parameters = new ParameterCollection();
parameters.Add("prop", "info|revisions");
parameters.Add("intoken", "edit");
parameters.Add("rvprop", "timestamp");
XmlDocument xml = wiki.Query(QueryBy.Titles, parameters, new string[] { title });
XmlNode node = xml.SelectSingleNode("//rev");
string baseTimeStamp = null;
if (node != null && node.Attributes["timestamp"] != null)
{
baseTimeStamp = node.Attributes["timestamp"].Value;
}
node = xml.SelectSingleNode("//page");
string editToken = node.Attributes["edittoken"].Value;
string pageFileName = directory + EscapePath(title);
string text = LoadPageFromCache(pageFileName, node.Attributes["lastrevid"].Value, title);
if (string.IsNullOrEmpty(text))
{
Console.Out.WriteLine("Downloading " + title + "...");
text = wiki.LoadText(title);
CachePage(pageFileName, node.Attributes["lastrevid"].Value, text);
}
WikiPage page = WikiPage.Parse(title, text);
page.BaseTimestamp = baseTimeStamp;
page.Token = editToken;
return page;
}
示例7: GetCollection
protected EmployeeCollection GetCollection(GetItemType SelectType, string SearchString, int ReturnCount)
{
//notes: return collection of groups
string strStoredProcName = "Elite_GetEmployee";
try
{
//notes: get base object properties you want hydrated and add any additional if necessary
ObjectPropertyDictionary objProperties = this.GetBaseProperties();
objProperties.Add("label", SqlDbType.VarChar);
objProperties.Add("value", SqlDbType.VarChar);
//notes: set the parameters to use for this query
ParameterCollection objParamCollection = new ParameterCollection();
objParamCollection.Add(ReturnCount.GetParameterInt("@ReturnCount"));
switch (SelectType)
{
case GetItemType.BY_SEARCH:
// 21 = GET_COLLECTION_BY_SEARCH
objParamCollection.Add((21).GetParameterListValue());
objParamCollection.Add(SearchString.GetParameterVarchar("@SearchString", 300));
break;
}
//notes: call local method to get list
return this.GetLocalCollection(objParamCollection, objProperties, strStoredProcName);
}
catch (Exception ex)
{
return new EmployeeCollection { StatusResult = new ResponseStatus("Get Employee Search Collection Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) };
}
}
示例8: CalculateLessFalseTest
public void CalculateLessFalseTest()
{
var parameters = new ParameterCollection() { new Parameter("x", 666) };
var lessThen = new LessOrEqual(new Variable("x"), new Number(10));
Assert.AreEqual(false, lessThen.Calculate(parameters));
}
示例9: ObjectDataProvider
//------------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
/// <summary>
/// Instantiates a new instance of a ObjectDataProvider
/// </summary>
public ObjectDataProvider()
{
_constructorParameters = new ParameterCollection(new ParameterCollectionChanged(OnParametersChanged));
_methodParameters = new ParameterCollection(new ParameterCollectionChanged(OnParametersChanged));
_sourceDataChangedHandler = new EventHandler(OnSourceDataChanged);
}
示例10: GetParameters
protected override IEnumerable<Parameter> GetParameters()
{
// XXX: Here be magic numbers
const int MpBaseParamKey = 8;
var parameters = new ParameterCollection();
var bpSheet = Sheet.Collection.GetSheet<BaseParam>();
if (Maximum > 0)
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueRelativeLimited(ParameterType.Base, Amount / 100.0, Maximum));
else
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueFixed(ParameterType.Base, Amount));
// ReSharper disable once InvertIf
if (MaximumHq != Maximum && AmountHq != Amount) {
if (MaximumHq > 0)
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueRelativeLimited(ParameterType.Hq, AmountHq / 100.0, MaximumHq));
else
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueFixed(ParameterType.Hq, AmountHq));
}
return parameters;
}
示例11: BoolAddNumberTest
public void BoolAddNumberTest()
{
var parameters = new ParameterCollection() { new Parameter("x", true) };
var add = new AddAssign(new Variable("x"), new Number(2));
Assert.Throws<NotSupportedException>(() => add.Execute(parameters));
}
示例12: CalculateGreaterTrueTest
public void CalculateGreaterTrueTest()
{
var parameters = new ParameterCollection() { new Parameter("x", 463) };
var greaterThen = new GreaterThan(new Variable("x"), new Number(10));
Assert.AreEqual(true, greaterThen.Calculate(parameters));
}
示例13: ParameterizedNamedItem
protected ParameterizedNamedItem()
: base() {
name = ItemName;
description = ItemDescription;
parameters = new ParameterCollection();
readOnlyParameters = null;
}
示例14: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
entity.Transform.Position = parameters.Get<Vector2>(0);
entity.AddFromPool<CDrop>().Initialize(DropType.BlackBox);
entity.AddFromPool<CLifeTime>().Initialize(100f);
entity.Tag = EntityTags.Drop;
}
示例15: GetItem
protected VendorItem GetItem(GetItemType SelectType, int VendorID)
{
string strStoredProcName = "jsp_Subscription_GetVendorItems";
try
{
//notes: set the parameters to use for this query
ParameterCollection objParamCollection = new ParameterCollection();
switch (SelectType)
{
case GetItemType.BY_ID:
objParamCollection.Add((10).GetParameterListValue());
objParamCollection.Add(VendorID.GetParameterInt("@VendorID"));
break;
}
//notes: get base object properties you want hydrated and add any additional if necessary
ObjectPropertyDictionary objProperties = this.GetBaseProperties();
//notes: call local method to get object item
return this.GetLocalItem(objParamCollection, objProperties, strStoredProcName);
}
catch (Exception ex)
{
return new VendorItem { StatusResult = new ResponseStatus("Get Vendor Item Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) };
}
}