本文整理汇总了C#中ParameterDefinition类的典型用法代码示例。如果您正苦于以下问题:C# ParameterDefinition类的具体用法?C# ParameterDefinition怎么用?C# ParameterDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterDefinition类属于命名空间,在下文中一共展示了ParameterDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: Copy
internal ParameterDefinition Copy()
{
var p = new ParameterDefinition(Name, Type, IsOptional);
p.ManagedName = ManagedName;
p.MarshalDirection = MarshalDirection;
return p;
}
示例3: Copy
internal ParameterDefinition Copy()
{
var p = new ParameterDefinition(Name, Type.Copy(), IsOptional);
p.IsOptional = IsOptional;
p.MarshalDirection = MarshalDirection;
return p;
}
示例4: From
internal static ParameterDefinitionModel From(ParameterDefinition parameterDefinition)
{
return new ParameterDefinitionModel()
{
ParameterDefinitionId = parameterDefinition.Id,
Name = parameterDefinition.Name,
ParameterType = parameterDefinition.DefinitionType
};
}
示例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);
}
}
示例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;
}
示例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);
}
示例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
};
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例13: WriteCtor
public override IDisposable WriteCtor(SpecificationDefinition specificationDefinition, string name,
ParameterDefinition[] parameters, IList<string> baseCallParameters)
{
return WriteGeneralMethod(specificationDefinition, name, false, null, parameters, baseCallParameters);
}
示例14: ReadConstant
public virtual void ReadConstant (ParameterDefinition param)
{
}
示例15: ReadMarshalSpec
public virtual void ReadMarshalSpec (ParameterDefinition param)
{
}