本文整理汇总了C#中ParameterCollection类的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection类的具体用法?C# ParameterCollection怎么用?C# ParameterCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterCollection类属于命名空间,在下文中一共展示了ParameterCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:cybermv,项目名称:BucketList,代码行数:26,代码来源:AddCommand.cs
示例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;
}
开发者ID:Powerino73,项目名称:paradox,代码行数:25,代码来源:TestRenderToTexture.cs
示例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());
}
开发者ID:theoju,项目名称:CleanCode,代码行数:25,代码来源:ParameterCollectionFixture.cs
示例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;
}
开发者ID:FERRERDEV,项目名称:xenko,代码行数:11,代码来源:ModelComponent.cs
示例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;
}
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:13,代码来源:Mesh.cs
示例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;
}
开发者ID:Claymore,项目名称:WikiBots,代码行数:31,代码来源:Cache.cs
示例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) };
}
}
开发者ID:jakebz33,项目名称:SubscriptionTest,代码行数:33,代码来源:EmployeeManager.cs
示例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));
}
开发者ID:smwentum,项目名称:xFunc,代码行数:7,代码来源:LessOrEqualTest.cs
示例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);
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:18,代码来源:ObjectDataProvider.cs
示例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;
}
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:27,代码来源:MpRecovery.cs
示例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));
}
开发者ID:sys27,项目名称:xFunc,代码行数:7,代码来源:AddAssignTest.cs
示例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));
}
开发者ID:smwentum,项目名称:xFunc,代码行数:7,代码来源:GreaterTest.cs
示例13: ParameterizedNamedItem
protected ParameterizedNamedItem()
: base() {
name = ItemName;
description = ItemDescription;
parameters = new ParameterCollection();
readOnlyParameters = null;
}
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:7,代码来源:ParameterizedNamedItem.cs
示例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;
}
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:7,代码来源:BlackBoxPrefab.cs
示例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) };
}
}
开发者ID:jakebz33,项目名称:SubscriptionTest,代码行数:28,代码来源:VendorItemManager.cs
示例16: Initialize
private void Initialize(Effect effect, ParameterCollection usedParameters)
{
if (effect == null) throw new ArgumentNullException("effect");
// TODO: Should we ignore various compiler keys such as CompilerParameters.GraphicsPlatformKey, CompilerParameters.GraphicsProfileKey and CompilerParameters.DebugKey?
// That was done previously in Effect.CompilerParameters
// TODO: Should we clone usedParameters? Or somehow make sure it is immutable? (for now it uses the one straight from EffectCompiler, which might not be a good idea...)
Parameters = usedParameters;
var parameters = usedParameters;
var internalValues = parameters.InternalValues;
SortedKeys = new ParameterKey[internalValues.Count];
SortedKeyHashes = new ulong[internalValues.Count];
SortedCompilationValues = new object[internalValues.Count];
SortedCounters = new int[internalValues.Count];
for (int i = 0; i < internalValues.Count; ++i)
{
var internalValue = internalValues[i];
SortedKeys[i] = internalValue.Key;
SortedKeyHashes[i] = internalValue.Key.HashCode;
SortedCompilationValues[i] = internalValue.Value.Object;
SortedCounters[i] = internalValue.Value.Counter;
}
var keyMapping = new Dictionary<ParameterKey, int>();
for (int i = 0; i < SortedKeys.Length; i++)
keyMapping.Add(SortedKeys[i], i);
Parameters.SetKeyMapping(keyMapping);
}
开发者ID:dejavvu,项目名称:paradox,代码行数:31,代码来源:DynamicEffectParameterUpdaterDefinition.cs
示例17: Initialize
public override void Initialize(IDatabaseEngine engine)
{
IDbCommand innerCommand = engine.CreateStoredProcedureCommand(_commandText);
var parameters = new ParameterCollection(innerCommand.Parameters);
initializeMembers(parameters, innerCommand);
}
开发者ID:joshuaflanagan,项目名称:structuremap,代码行数:7,代码来源:StoredProcedureCommand.cs
示例18: UpdatedUsedParameters
public void UpdatedUsedParameters(Effect effect, ParameterCollection parameters)
{
// Try to update counters only if possible
var internalValues = parameters.InternalValues;
bool parameterKeyMatches = SortedCounters.Length == internalValues.Count;
if (parameterKeyMatches)
{
for (int i = 0; i < internalValues.Count; ++i)
{
if (SortedKeys[i] != internalValues[i].Key)
{
parameterKeyMatches = false;
break;
}
SortedCounters[i] = internalValues[i].Value.Counter;
}
}
// Somehow, the used parameters changed, we need a full reset
if (!parameterKeyMatches)
{
Initialize(effect, parameters);
}
}
开发者ID:dejavvu,项目名称:paradox,代码行数:25,代码来源:DynamicEffectParameterUpdaterDefinition.cs
示例19: CalculateLessTrueTest
public void CalculateLessTrueTest()
{
var parameters = new ParameterCollection() { new Parameter("x", 0) };
var lessThen = new LessThan(new Variable("x"), new Number(10));
Assert.AreEqual(true, lessThen.Calculate(parameters));
}
开发者ID:smwentum,项目名称:xFunc,代码行数:7,代码来源:LessThanTest.cs
示例20: GetItem
protected Employee GetItem(GetItemType SelectType, int TKID, string FirstName, string LastName)
{
string strStoredProcName = "Elite_GetEmployee";
try
{
//notes: set the parameters to use for this query
ParameterCollection objParamCollection = new ParameterCollection();
//notes: ListValue options
switch (SelectType)
{
case GetItemType.BY_TKID:
// 10 = GET_ITEM_BY_ID
objParamCollection.Add((10).GetParameterListValue());
objParamCollection.Add(TKID.GetParameterInt("@TKID"));
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 Employee { StatusResult = new ResponseStatus("Get Item by ID Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) };
}
}
开发者ID:jakebz33,项目名称:SubscriptionTest,代码行数:30,代码来源:EmployeeManager.cs
注:本文中的ParameterCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论