本文整理汇总了C#中ParameterInfo类的典型用法代码示例。如果您正苦于以下问题:C# ParameterInfo类的具体用法?C# ParameterInfo怎么用?C# ParameterInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterInfo类属于命名空间,在下文中一共展示了ParameterInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnSerializing
private void OnSerializing() {
Animator animator = GetComponent<Animator>();
// Store the current state for each layer
layerData = new LayerInfo[animator.layerCount];
for (int i = 0; i < animator.layerCount; i++) {
layerData[i] = new LayerInfo {
index = i,
currentHash = animator.GetCurrentAnimatorStateInfo(i).shortNameHash,
nextHash = animator.GetNextAnimatorStateInfo(i).shortNameHash,
normalizedTimeCurrent = animator.GetCurrentAnimatorStateInfo(i).normalizedTime,
normalizedTimeNext = animator.GetNextAnimatorStateInfo(i).normalizedTime,
weight = animator.GetLayerWeight(i)
};
}
// Store every parameter
parameterData = new ParameterInfo[animator.parameterCount];
for (int i = 0; i < animator.parameterCount; i++) {
parameterData[i] = new ParameterInfo {
number = animator.parameters[i].nameHash,
type = animator.parameters[i].type,
value = GetParameterValue(animator.parameters[i].nameHash, animator.parameters[i].type, animator)
};
}
}
开发者ID:BubbleRap,项目名称:ExploreTheDarkness,代码行数:26,代码来源:StoreAnimator.cs
示例2: ConvertParameters
public static void ConvertParameters(EngineManager manager, ParameterInfo[] parameterInfo, ref object[] parameters)
{
for (int i = 0; i < parameterInfo.Length; i++)
{
if (Common.TypeInheritsFrom(parameterInfo[i].ParameterType, typeof(EngineObject)) && parameters[i].GetType() == typeof(int))
{
parameters[i] = manager.GetObject<EngineObject>((int)parameters[i]);
}
if (parameterInfo[i].ParameterType == typeof(object[]))
{
object[] tempObjects = new object[parameters.Length - i];
for (int j = 0; j < tempObjects.Length; j++)
{
tempObjects[j] = parameters[i + j];
}
parameters[i] = tempObjects;
object[] newParameters = new object[i + 1];
for (int j = 0; j < newParameters.Length; j++)
{
newParameters[j] = parameters[j];
}
parameters = newParameters;
}
}
}
开发者ID:NerdsRUs,项目名称:Summer2014,代码行数:30,代码来源:EngineEvent.cs
示例3: CreateUrl
public override string CreateUrl(ParameterInfo yeepay)
{
var info = yeepay as YeePayParasInfo;
if (info == null) return "";
//签名
var sb = "Buy";
sb += Configs.GetPartnerId();
sb += info.OrderNum;
sb += info.Amount.ToString("0.00");
sb += info.Cur;
sb += info.ProName;
sb += info.ProCate;
sb += info.ProDesc;
sb += info.ReturnUrl;
sb += info.Saf;
sb += info.ExtentInfo;
sb += info.FrpId;
sb += (info.NeedResponse ? "1" : "0");
var hmac = Digest.HmacSign(sb, Configs.GetKey());
var url = Configs.RequestPayUrl;
url += string.Format(Configs.Paras, Configs.GetPartnerId(),
HttpUtility.UrlEncode(info.OrderNum, Configs.DefCoding), info.Amount.ToString("0.00"), info.Cur,
HttpUtility.UrlEncode(info.ProName, Configs.DefCoding),
HttpUtility.UrlEncode(info.ProCate, Configs.DefCoding),
HttpUtility.UrlEncode(info.ProDesc, Configs.DefCoding),
HttpUtility.UrlEncode(info.ReturnUrl, Configs.DefCoding),
info.Saf, HttpUtility.UrlEncode(info.ExtentInfo, Configs.DefCoding), info.FrpId,
(info.NeedResponse ? "1" : "0"), hmac);
return url;
}
开发者ID:shoy160,项目名称:Shoy.Common,代码行数:31,代码来源:Base.cs
示例4: VisitParameter
public override void VisitParameter(ParameterAttribute parameter)
{
_parameterInfo = new ParameterInfo(CurrentProperty, parameter);
_cmdletInfo.AddParameter(_parameterInfo);
base.VisitParameter(parameter);
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:GetSnapinHelpCommand.Visitor.cs
示例5: CreateNewConcepts
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts)
{
var newConcepts = new List<IConceptInfo>();
ParameterInfo filterParameter;
var filterNameElements = FilterName.Split('.');
if (filterNameElements.Count() == 2)
filterParameter = new ParameterInfo { Module = new ModuleInfo { Name = filterNameElements[0] }, Name = filterNameElements[1] };
else
filterParameter = new ParameterInfo { Module = Source.Module, Name = FilterName };
if (!existingConcepts.OfType<DataStructureInfo>() // Existing filter parameter does not have to be a ParameterInfo. Any DataStructureInfo is allowed.
.Any(item => item.Module.Name == filterParameter.Module.Name && item.Name == filterParameter.Name))
newConcepts.Add(filterParameter);
var composableFilter = new ComposableFilterByInfo
{
Source = Source,
Parameter = filterParameter.GetKeyProperties(),
Expression = "(source, repository, parameter) => source.Where(" + Expression + ")"
};
newConcepts.Add(composableFilter);
return newConcepts;
}
开发者ID:koav,项目名称:Rhetos,代码行数:26,代码来源:ItemFilterInfo.cs
示例6: GetValueFactory
public Expression<Func<object>> GetValueFactory(string key, ParameterInfo parameter = null)
{
Guard.EnsureIsNotNullOrEmpty("key", key);
if (!Delegates.ContainsKey(key))
{
return null;
}
var expression = Delegates[key];
var parameterExpression = expression.Parameters
.SafeSelect(p => p)
.FirstOrDefault();
if (parameter.IsNull() || parameterExpression.IsNull())
{
return Expression.Lambda<Func<object>>(expression.Body, null);
}
var blockExpression = Expression.Block(
new[] { parameterExpression },
// ReSharper disable AssignNullToNotNullAttribute
// ReSharper disable once PossibleNullReferenceException
Expression.Assign(parameterExpression, Expression.Constant(parameter.Value)),
//Expression.Constant(parameter.Value, parameter.Type)),
// ReSharper restore AssignNullToNotNullAttribute
expression.Body);
return Expression.Lambda<Func<object>>(blockExpression, null);
}
开发者ID:joncrump,项目名称:Jon.Crump.Common,代码行数:30,代码来源:ValueFactory.cs
示例7: CreateNewConcepts
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts)
{
var filterParameter = new ParameterInfo
{
Module = Property.DataStructure.Module,
Name = Property.Name + "_RegExMatchFilter",
};
string filterExpression = string.Format(@"(source, repository, parameter) =>
{{
var items = source.Where(item => !string.IsNullOrEmpty(item.{0})).Select(item => new {{ item.ID, item.{0} }}).ToList();
var regex = new System.Text.RegularExpressions.Regex({1});
var invalidItemIds = items.Where(item => !regex.IsMatch(item.{0})).Select(item => item.ID).ToList();
return Filter(source, invalidItemIds);
}}",
Property.Name,
CsUtility.QuotedString("^" + RegularExpression + "$"));
var itemFilterRegExMatchProperty = new ComposableFilterByInfo
{
Expression = filterExpression,
Parameter = filterParameter.Module.Name + "." + filterParameter.Name,
Source = Property.DataStructure
};
var invalidDataRegExMatchProperty = new InvalidDataMarkPropertyInfo
{
DependedProperty = Property,
FilterType = itemFilterRegExMatchProperty.Parameter,
ErrorMessage = ErrorMessage,
Source = Property.DataStructure
};
return new IConceptInfo[] { filterParameter, itemFilterRegExMatchProperty, invalidDataRegExMatchProperty };
}
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:35,代码来源:RegExMatchInfo.cs
示例8: ParameterInfo
private ParameterInfo(ParameterInfo accessor, MemberInfo member)
{
this.MemberImpl = member;
this.NameImpl = accessor.Name;
this.ClassImpl = accessor.ParameterType;
this.PositionImpl = accessor.Position;
this.AttrsImpl = accessor.Attributes;
}
开发者ID:modulexcite,项目名称:IL2JS,代码行数:8,代码来源:ParameterInfo.cs
示例9: GetDefaultValuesForParameters
private static object[] GetDefaultValuesForParameters(ParameterInfo[] paramTypes)
{
Object[] parameters = new Object[paramTypes.Length];
for (int i = 0; i < paramTypes.Length; i++)
{
parameters[i] = Activator.CreateInstance(paramTypes[i].ParameterType);
}
return parameters;
}
开发者ID:JVinhais,项目名称:ave-2015-16-sem1-i41n,代码行数:9,代码来源:1.0.TPC04.cs
示例10: ParameterName
static string ParameterName (ParameterInfo parameter)
{
switch (parameter.Name) {
case "break":
case "continue":
case "finally":
return "@" + parameter.Name;
}
return parameter.Name;
}
开发者ID:transformersprimeabcxyz,项目名称:mono.linq.expressions,代码行数:11,代码来源:fluentextensions-generator.cs
示例11: CalculatorBot
public CalculatorBot(string token)
: base("calculator", token)
{
var command = new CommandInfo("/start");
command.StaticAcceptMessage = "Ok you started the calculator";
Configuration.Commands.Add(command);
Configuration.StaticUnknownCommandMessage = "Unknown command. Please try another command. Send /start to get a list of available comands.";
var command2 = new CommandInfo("/newbrand");
command2.StaticAcceptMessage = "New brand is saved.";
var parameter = new ParameterInfo() { Name = "Name", Type = ParameterTypes.Text, Optional = false, StaticPrompt = "Ok, enter new brand name." };
command2.Parameters.Add(parameter);
Configuration.Commands.Add(command2);
}
开发者ID:themehrdad,项目名称:NetTelebot,代码行数:13,代码来源:CalculatorBot.cs
示例12: GetParameters
public sealed override ParameterInfo[] GetParameters()
{
if (ReflectionTrace.Enabled)
ReflectionTrace.MethodBase_GetParameters(this);
RuntimeParameterInfo[] runtimeParametersAndReturn = this.RuntimeParametersAndReturn;
if (runtimeParametersAndReturn.Length == 1)
return Array.Empty<ParameterInfo>();
ParameterInfo[] result = new ParameterInfo[runtimeParametersAndReturn.Length - 1];
for (int i = 0; i < result.Length; i++)
result[i] = runtimeParametersAndReturn[i + 1];
return result;
}
开发者ID:huamichaelchen,项目名称:corert,代码行数:13,代码来源:RuntimeConstructorInfo.cs
示例13: GenerateParam
public static MySqlParameter[] GenerateParam(ParameterInfo[] methodParameters, params object[] Values)
{
int length = methodParameters.Length;
MySqlParameter[] sqlParams = new MySqlParameter[length];
for (int i = 0; i < length; i++)
{
MySqlParameter parameter = new MySqlParameter();
parameter.ParameterName = "@" + methodParameters[i].Name;
parameter.Value = Values[i];
sqlParams[i] = parameter;
}
return sqlParams;
}
开发者ID:gacaromar,项目名称:Restaurant,代码行数:15,代码来源:DataAccessLayer.cs
示例14: AddValueFactory
protected void AddValueFactory(ValueFactoryModelBase model,
string loaderKey, ParameterInfo parameter = null)
{
if (model.IsNull())
{
return;
}
Guard.EnsureIsNotNullOrEmpty("loaderKey", loaderKey);
var valueExpression = ValueFactory.GetValueFactory(
loaderKey, parameter);
valueExpression.Do(() =>
model.ValueFactories.Add(loaderKey, valueExpression.Compile()));
}
开发者ID:joncrump,项目名称:Jon.Crump.Common,代码行数:16,代码来源:ValueFactoryBuilderBase.cs
示例15: StoredProcedureInfo
/// <summary>
/// Creates a new instance of the StoredProcedureInfo class.
/// This constructor is private; call the static GetInfo() method instead.
/// </summary>
/// <param name="connectionName">Name of the database connection.</param>
/// <param name="schema">Name of the database schema.</param>
/// <param name="procedureName">Name of the stored procedure.</param>
private StoredProcedureInfo(string connectionName, string schema, string procedureName)
{
this.ConnectionName = connectionName;
this.Schema = schema;
this.ProcedureName = procedureName;
// query the database for the procedure's parameters;
// if the procedure doesn't exist, zero parameters will be found, successfully (no error)
var parametersQuery = new StoredProcedureQuery("SelectStoredProcedureParameters", connectionName);
parametersQuery.Parameters.Add("Schema", this.Schema);
parametersQuery.Parameters.Add("ProcedureName", this.ProcedureName);
DataSet results = parametersQuery.ReturnAllTables();
var parameters = results.Tables[0]; // no rows if the procedure has no parameters
var columnNames = results.Tables[1]; // no rows if the procedure has no TVPs; all TVPs' columns otherwise
foreach (DataRow parameter in parameters.Rows)
{
var param = new ParameterInfo
{
Name = parameter["ParameterName"] as string,
TypeString = parameter["DataType"] as string,
UserDefinedTypeName = parameter["UserDefinedTypeName"] as string,
MaxLength = parameter["MaxLength"] as int?
};
// TODO: switch this logic around when we internationalize the db to use nvarchar columns
if (param.TypeString == "varchar")
param.Type = SqlDbType.VarChar;
else if (param.TypeString == "char")
param.Type = SqlDbType.Char;
else if (param.TypeString == "nvarchar")
param.Type = SqlDbType.NVarChar;
else if (param.TypeString == "nchar")
param.Type = SqlDbType.NChar;
else if (param.TypeString == "table type")
{
param.Type = SqlDbType.Structured;
// get the table type's column names
param.ColumnNames = columnNames.Select("ParameterName = '" + param.Name + "'")
.Select(dr => dr["ColumnName"] as string).ToArray();
}
this.Parameters.Add(param);
}
}
开发者ID:nayassubramanian899,项目名称:StoreFinder,代码行数:54,代码来源:StoredProcedureInfo.cs
示例16: MethodVisitor
// TODO, refactoring
public MethodVisitor(IClassRepository repository, ClassInfo classInfo,
string name, string descriptor, string signature, string[] exceptions,
bool isStatic, bool isFinal, Visibility visibility)
{
Repository = repository;
ClassInfo = classInfo;
Name = name;
Descriptor = descriptor;
IsStatic = isStatic;
IsFinal = isFinal;
Visibility = visibility;
var slot = 0;
if (!IsStatic)
{
var thisType = ClrType.FromDescriptor(classInfo.Name);
methodThis = new ParameterInfo("this", thisType);
//slots.Add(slot++, methodThis);
slot ++;
parameters.Add(methodThis);
}
var rightBraceIndex = descriptor.IndexOf(')');
var parameterString = descriptor.Substring(1, rightBraceIndex - 1);
if (parameterString.Length > 0)
{
var parameters1 = parameterString.Split(',');
foreach (var parameter in parameters1)
{
var parameterType = new Type(parameter);
//ParameterInfo parameterInfo = new ParameterInfo("param_" + slot, parameterType);
var parameterInfo = new ParameterInfo("param_" + slot, parameterType);
parameters.Add(parameterInfo);
//slots.Add(slot++, parameterInfo);
slot++;
if (ClrType.IsDoubleSlot(parameterType))
{
slot++;
}
}
}
}
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:47,代码来源:MethodVisitor.cs
示例17: SharpKitMethodName
public static string SharpKitMethodName(string methodName, ParameterInfo[] paramS, bool overloaded, int TCounts = 0)
{
string name = methodName;
if (overloaded)
{
if (TCounts > 0)
name += "T" + TCounts.ToString();
for (int i = 0; i < paramS.Length; i++)
{
Type type = paramS[i].ParameterType;
name += "$$" + SharpKitTypeName(type);
}
name = name.Replace("`", "T");
}
name = name.Replace("$", "_");
return name;
}
开发者ID:benbon,项目名称:qjsbunitynew,代码行数:17,代码来源:CSGenerator.cs
示例18: ParameterEditForm
public ParameterEditForm(dao.QAParameter param, string paramType, bool autoStoreChanges)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
if (param == null)
throw new ArgumentNullException("param", "Cannot pass null parameter to ParameterEditForm");
this._param = param;
switch (paramType)
{
case BooleanParameterInfo.TYPE_WKT:
this._pinfo = new BooleanParameterInfo(param.Name, "", param.Value);
break;
case IntegerParameterInfo.TYPE_WKT:
this._pinfo = new IntegerParameterInfo(param.Name, "", param.Value);
break;
case DoubleParameterInfo.TYPE_WKT:
this._pinfo = new DoubleParameterInfo(param.Name, "", param.Value);
break;
case StringParameterInfo.TYPE_WKT:
this._pinfo = new StringParameterInfo(param.Name, "", param.Value);
break;
case ChooseLayerParameterInfo.TYPE_WKT:
this._pinfo = new ChooseLayerParameterInfo(param.Name, "", param.Value);
break;
case ChooseTableParameterInfo.TYPE_WKT:
this._pinfo = new ChooseTableParameterInfo(param.Name, "", param.Value);
break;
case UnitsParameterInfo.TYPE_WKT:
this._pinfo = new UnitsParameterInfo(param.Name, "", param.Value);
break;
default:
this._pinfo = null;
break;
}
if (this._pinfo == null)
throw new ArgumentException("Unknown type of ParameterInfo specified", "paramType");
this._autoStore = autoStoreChanges;
}
开发者ID:EAWCS1,项目名称:SUITT,代码行数:45,代码来源:ParameterEditForm.cs
示例19: FormatValue
private static object FormatValue(ParameterInfo[] pInfos, int index, byte controlFlag, uint value)
{
var pInfo = (index < pInfos.Length) ? pInfos[index] : new ParameterInfo();
var opType = (OpCodeFlag) (pInfo.Type == ParamType.Destination ? controlFlag & 3 : controlFlag >> 2 & 3);
switch (opType)
{
case OpCodeFlag.Register:
return string.Concat('r', value + 1).PadRight(12);
case OpCodeFlag.Constant:
return string.Concat('$', value).PadRight(12);
case OpCodeFlag.MemoryAddress:
return string.Concat("[r", value + 1, ']').PadRight(12);
case OpCodeFlag.None:
return string.Empty.PadRight(12);
default:
throw new ArgumentOutOfRangeException();
}
}
开发者ID:andy-uq,项目名称:TinyOS,代码行数:23,代码来源:InstructionFormatter.cs
示例20: Signature
private static string Signature(string name, ParameterInfo[] allpi)
{
StringBuilder sb = new StringBuilder();
sb.Append(name);
sb.Append("(");
bool first = true;
foreach(ParameterInfo pi in allpi)
{
if(first)
{
first = false;
}
else
{
sb.Append(",");
}
sb.Append(pi.ParameterType.ToString());
sb.Append(" ");
sb.Append(pi.Name);
}
sb.Append(")");
return sb.ToString();
}
开发者ID:sailesh341,项目名称:JavApi,代码行数:23,代码来源:SerialUIDCalculator.cs
注:本文中的ParameterInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论