本文整理汇总了C#中ParameterDefinition类的典型用法代码示例。如果您正苦于以下问题:C# ParameterDefinition类的具体用法?C# ParameterDefinition怎么用?C# ParameterDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterDefinition类属于命名空间,在下文中一共展示了ParameterDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Read
public void Read(ClrModuleReader reader)
{
this.ParameterDefinition = new ParameterDefinition();
this.ParameterDefinition.Attributes = (ParamAttributes)reader.Binary.ReadUInt16();
this.Sequence = reader.Binary.ReadUInt16();
this.ParameterDefinition.Name = reader.ReadString();
}
开发者ID:BGCX261,项目名称:zoompe-git,代码行数:7,代码来源:ParamEntry.cs
示例2: Copy
internal ParameterDefinition Copy()
{
var p = new ParameterDefinition(Name, Type, IsOptional);
p.ManagedName = ManagedName;
p.MarshalDirection = MarshalDirection;
return p;
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:7,代码来源:ParameterDefinition.cs
示例3: Copy
internal ParameterDefinition Copy()
{
var p = new ParameterDefinition(Name, Type.Copy(), IsOptional);
p.IsOptional = IsOptional;
p.MarshalDirection = MarshalDirection;
return p;
}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:7,代码来源:ParameterDefinition.cs
示例4: From
internal static ParameterDefinitionModel From(ParameterDefinition parameterDefinition)
{
return new ParameterDefinitionModel()
{
ParameterDefinitionId = parameterDefinition.Id,
Name = parameterDefinition.Name,
ParameterType = parameterDefinition.DefinitionType
};
}
开发者ID:hendrikdelarey,项目名称:appcampus,代码行数:9,代码来源:ParameterDefinitionModel.cs
示例5: MethodDefinition
public MethodDefinition(string name, ClassDefinition parent, int numArgs)
{
Name = name;
Parent = parent;
Parameters = new ParameterDefinition[numArgs];
if (parent != null)
{
parent.Methods.Add(this);
}
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:11,代码来源:MethodDefinition.cs
示例6: AddParameter
public static IParameterDefinition AddParameter(this MethodDefinition method,
ushort parameterIndex, string parameterName, ITypeReference parameterType, IMetadataHost host, bool isOut, bool isRef)
{
var fakeMethodParameter = new ParameterDefinition();
fakeMethodParameter.ContainingSignature = method;
fakeMethodParameter.Index = parameterIndex;
fakeMethodParameter.IsByReference = false;
fakeMethodParameter.Type = parameterType;
fakeMethodParameter.Name = host.NameTable.GetNameFor(parameterName);
fakeMethodParameter.IsOut = isOut;
fakeMethodParameter.IsByReference = isRef;
method.Parameters.Add(fakeMethodParameter);
return fakeMethodParameter;
}
开发者ID:jamarchist,项目名称:SharpMock,代码行数:16,代码来源:MethodDefinitionExtensions.cs
示例7: AddParameterIndex
public void AddParameterIndex()
{
var object_ref = new TypeReference ("System", "Object", null, null, false);
var method = new MethodDefinition ("foo", MethodAttributes.Static, object_ref);
var x = new ParameterDefinition ("x", ParameterAttributes.None, object_ref);
var y = new ParameterDefinition ("y", ParameterAttributes.None, object_ref);
method.Parameters.Add (x);
method.Parameters.Add (y);
Assert.AreEqual (0, x.Index);
Assert.AreEqual (1, y.Index);
Assert.AreEqual (method, x.Method);
Assert.AreEqual (method, y.Method);
}
开发者ID:ttRevan,项目名称:cecil,代码行数:17,代码来源:ParameterTests.cs
示例8: DateFunctionParamInfo
private static ParameterDefinition[] DateFunctionParamInfo()
{
var optionalParam = new ParameterDefinition()
{
HasDefaultValue = true,
IsByValue = true
};
return new ParameterDefinition[6]
{
new ParameterDefinition(){IsByValue = true},
optionalParam,
optionalParam,
optionalParam,
optionalParam,
optionalParam
};
}
开发者ID:pauliv2,项目名称:OneScript,代码行数:18,代码来源:BuiltinFunctions.cs
示例9: WriteDataContextCtor
protected virtual bool WriteDataContextCtor(CodeWriter writer, Database schema, Type contextBaseType,
ParameterDefinition[] parameters, string[] baseCallParameterNames, Type[] baseCallParameterTypes,
GenerationContext context)
{
// if we have a contextBaseType, then check that we can do it
if (contextBaseType != null)
{
var ctor = contextBaseType.GetConstructor(baseCallParameterTypes);
if (ctor == null)
return false;
}
using (writer.WriteCtor(SpecificationDefinition.Public, schema.Class, parameters, baseCallParameterNames))
{
writer.WriteLine(writer.GetStatement(writer.GetMethodCallExpression("OnCreated")));
}
writer.WriteLine();
return true;
}
开发者ID:nlhepler,项目名称:mono,代码行数:18,代码来源:CodeGenerator.Context.Ctor.cs
示例10: AnonymousMethodBodyBuilder
public AnonymousMethodBodyBuilder(IMetadataHost host, IUnitReflector reflector, ITypeReference delegateType, Type returnType, ParameterInfo[] parameters)
{
this.host = host;
this.reflector = reflector;
this.delegateType = delegateType;
this.returnTypeReference = reflector.Get(returnType);
foreach (var parameter in parameters)
{
var parameterDefinition = new ParameterDefinition();
parameterDefinition.Index = (ushort)parameter.Position;
parameterDefinition.Type = reflector.Get(parameter.ParameterType);
parameterDefinition.Name = host.NameTable.GetNameFor("altered" + parameter.Name);
parameterDefinition.ContainingSignature = method;
method.Parameters.Add(parameterDefinition);
}
}
开发者ID:jamarchist,项目名称:SharpMock,代码行数:19,代码来源:AnonymousMethodBodyBuilder.cs
示例11: ConstructorBasedImportDefinition
/// <summary>
/// Initializes a new instance of the <see cref="ConstructorBasedImportDefinition"/> class.
/// </summary>
/// <param name="contractName">The contract name that is used to identify the current import.</param>
/// <param name="requiredTypeIdentity">The type identity of the export type expected.</param>
/// <param name="cardinality">
/// One of the enumeration values that indicates the cardinality of the export object required by the import definition.
/// </param>
/// <param name="creationPolicy">
/// A value that indicates that the importer requires a specific creation policy for the exports used to satisfy this import.
/// </param>
/// <param name="declaringType">The type that declares the constructor on which the import is placed.</param>
/// <param name="constructor">The constructor that declares the import.</param>
/// <param name="parameter">The parameter on which the import is defined.</param>
private ConstructorBasedImportDefinition(
string contractName,
TypeIdentity requiredTypeIdentity,
ImportCardinality cardinality,
CreationPolicy creationPolicy,
TypeIdentity declaringType,
ConstructorDefinition constructor,
ParameterDefinition parameter)
: base(contractName,
requiredTypeIdentity,
cardinality,
false,
true,
creationPolicy,
declaringType)
{
{
Lokad.Enforce.Argument(() => parameter);
}
m_Constructor = constructor;
m_Parameter = parameter;
}
开发者ID:pvandervelde,项目名称:Apollo,代码行数:37,代码来源:ConstructorBasedImportDefinition.cs
示例12: CreateTextWidgetDefinition
private void CreateTextWidgetDefinition()
{
var widgetDefinition = WidgetDefinitionRepository.FindByName("Text");
ParameterDefinition textParameterDefinition = new ParameterDefinition("Text");
ParameterDefinition fontSizeParameterDefinition = new ParameterDefinition("FontSize");
ParameterDefinition textColourParameterDefinition = new ParameterDefinition("TextColour");
if (widgetDefinition == null)
{
widgetDefinition = new WidgetDefinition("Text");
widgetDefinition.AddParameterDefinition(textParameterDefinition);
widgetDefinition.AddParameterDefinition(fontSizeParameterDefinition);
widgetDefinition.AddParameterDefinition(textColourParameterDefinition);
WidgetDefinitionRepository.Add(widgetDefinition);
}
else
{
if (!widgetDefinition.ParameterDefinitions.Any(x => x.Name == "Text"))
{
widgetDefinition.AddParameterDefinition(textParameterDefinition);
WidgetDefinitionRepository.Update(widgetDefinition);
}
if (!widgetDefinition.ParameterDefinitions.Any(x => x.Name == "FontSize"))
{
widgetDefinition.AddParameterDefinition(fontSizeParameterDefinition);
WidgetDefinitionRepository.Update(widgetDefinition);
}
if (!widgetDefinition.ParameterDefinitions.Any(x => x.Name == "TextColour"))
{
widgetDefinition.AddParameterDefinition(textColourParameterDefinition);
WidgetDefinitionRepository.Update(widgetDefinition);
}
}
}
开发者ID:hendrikdelarey,项目名称:appcampus,代码行数:37,代码来源:Startup.Auth.cs
示例13: WriteCtor
public override IDisposable WriteCtor(SpecificationDefinition specificationDefinition, string name,
ParameterDefinition[] parameters, IList<string> baseCallParameters)
{
return WriteGeneralMethod(specificationDefinition, name, false, null, parameters, baseCallParameters);
}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:CSCodeWriter.cs
示例14: ReadConstant
public virtual void ReadConstant (ParameterDefinition param)
{
}
开发者ID:nobled,项目名称:mono,代码行数:3,代码来源:BaseReflectionReader.cs
示例15: ReadMarshalSpec
public virtual void ReadMarshalSpec (ParameterDefinition param)
{
}
开发者ID:nobled,项目名称:mono,代码行数:3,代码来源:BaseReflectionReader.cs
示例16: Emit
public void Emit(OpCode opcode, ParameterDefinition parameter)
{
Append (Create (opcode, parameter));
}
开发者ID:ttRevan,项目名称:cecil,代码行数:4,代码来源:ILProcessor.cs
示例17: Create
public Instruction Create(OpCode opcode, ParameterDefinition parameter)
{
return Instruction.Create (opcode, parameter);
}
开发者ID:ttRevan,项目名称:cecil,代码行数:4,代码来源:ILProcessor.cs
示例18: ReadMethodDefinition
static void ReadMethodDefinition(XmlReader reader, ClassDefinition @class)
{
string name = reader.GetAttribute("Name");
string isExcluded = reader.GetAttribute("IsExcluded");
var parameters = new List<ParameterDefinition>();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.EndElement)
{
break;
}
if (reader.NodeType != XmlNodeType.Element)
{
continue;
}
switch (reader.Name)
{
case "Parameter":
{
string parameterName = reader.GetAttribute("Name");
var parameter = new ParameterDefinition(parameterName, null);
string marshalDirectionString = reader.GetAttribute("MarshalDirection");
if (marshalDirectionString != null)
{
MarshalDirection marshalDirection;
if (Enum.TryParse(marshalDirectionString, out marshalDirection))
{
parameter.MarshalDirection = marshalDirection;
}
}
parameters.Add(parameter);
}
continue;
}
}
var method = new MethodDefinition(name, @class, parameters.Count);
for (int i = 0; i < parameters.Count; i++)
{
method.Parameters[i] = parameters[i];
}
if ("true".Equals(isExcluded))
{
method.IsExcluded = true;
}
}
开发者ID:sinkingsugar,项目名称:BulletSharpPInvoke,代码行数:50,代码来源:WrapperProjectXmlReader.cs
示例19: GetParameterIndex
int GetParameterIndex (ParameterDefinition parameter)
{
if (body.method.HasThis) {
if (parameter == body.this_parameter)
return 0;
return parameter.Index + 1;
}
return parameter.Index;
}
开发者ID:mayuki,项目名称:Inazuma,代码行数:11,代码来源:CodeWriter.cs
示例20: BuildMethod
public override void BuildMethod()
{
AddStatement.DeclareInterceptedType(field.ContainingType.ResolvedType);
Context.Log.WriteTrace(" Adding: var interceptedField = interceptedType.GetField('{0}');", field.Name.Value);
Context.Block.Statements.Add(
Declare.Variable<FieldInfo>("interceptedField").As(
Call.VirtualMethod("GetField", typeof (string)).ThatReturns<FieldInfo>().WithArguments(
Constant.Of(field.Name.Value)).On("interceptedType"))
);
AddStatement.DeclareArgumentsList();
AddStatement.AddArgumentToList(Params["assignedValue"]);
var actionT = SharpMockTypes.Actions[1];
var actionActualT = new GenericTypeInstanceReference();
actionActualT.GenericType = actionT;
actionActualT.GenericArguments.Add(field.Type);
var assignment = new AnonymousDelegate();
assignment.Type = actionActualT;
assignment.ReturnType = Context.Host.PlatformType.SystemVoid;
assignment.CallingConvention = CallingConvention.HasThis;
var parameterDefinition = new ParameterDefinition();
parameterDefinition.Index = 0;
parameterDefinition.Type = field.Type;
parameterDefinition.Name = Context.Host.NameTable.GetNameFor("alteredValue");
parameterDefinition.ContainingSignature = assignment;
assignment.Parameters.Add(parameterDefinition);
var assignmentBody = new BlockStatement();
var assignActualField = new ExpressionStatement();
var actualField = new TargetExpression();
actualField.Type = field.Type;
actualField.Definition = field;
var value = new BoundExpression();
value.Type = field.Type;
value.Definition = parameterDefinition;
var assignValueToField = new Assignment();
assignValueToField.Source = value;
assignValueToField.Target = actualField;
assignValueToField.Type = field.Type;
assignActualField.Expression = assignValueToField;
actualField.Type = field.Type;
actualField.Definition = field;
assignmentBody.Statements.Add(assignActualField);
assignmentBody.Statements.Add(new ReturnStatement());
assignment.Body = assignmentBody;
Context.Block.Statements.Add(
Declare.Variable("local_0", actionActualT).As(assignment)
);
AddStatement.DeclareRegistryInterceptor();
AddStatement.DeclareInvocation();
AddStatement.SetArgumentsOnInvocation();
AddStatement.SetOriginalCallOnInvocation();
AddStatement.SetTargetOnInvocationToNull();
Context.Block.Statements.Add(
Do(Call.PropertySetter<MemberInfo>("OriginalCallInfo").WithArguments("interceptedField").On("invocation"))
);
AddStatement.CallShouldInterceptOnInterceptor();
AddStatement.CallInterceptOnInterceptor();
Context.Block.Statements.Add(Return.Void());
}
开发者ID:jamarchist,项目名称:SharpMock,代码行数:72,代码来源:ReplacementStaticFieldAssignmentBuilder.cs
注:本文中的ParameterDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论