本文整理汇总了C#中IType.IsPrimitiveType方法的典型用法代码示例。如果您正苦于以下问题:C# IType.IsPrimitiveType方法的具体用法?C# IType.IsPrimitiveType怎么用?C# IType.IsPrimitiveType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.IsPrimitiveType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefineType
public object DefineType(IType type)
{
var line = 0;
var offset = 0;
var flags = 0;
object typeMetadata;
if (this.typesMetadataCache.TryGetValue(type, out typeMetadata))
{
return typeMetadata;
}
if (type.IsPrimitiveType())
{
typeMetadata = this.DefinePrimitiveType(type, line, offset, flags);
this.typesMetadataCache[type] = typeMetadata;
}
else
{
var structureType = new CollectionMetadata(this.indexedMetadata);
var reference = this.structuresByName ? (object)type.FullName : (object)structureType;
this.typesMetadataCache[type] = reference;
this.DefineStructureType(type, line, offset, flags, structureType);
typeMetadata = reference;
}
return typeMetadata;
}
示例2: WriteMemSet
/// <summary>
/// </summary>
/// <param name="llvmWriter">
/// </param>
/// <param name="type">
/// </param>
/// <param name="op1">
/// </param>
public static void WriteMemSet(this LlvmWriter llvmWriter, IType type, FullyDefinedReference op1)
{
var writer = llvmWriter.Output;
writer.Write(
"call void @llvm.memset.p0i8.i32(i8* {0}, i8 0, i32 {1}, i32 {2}, i1 false)",
op1,
type.GetTypeSize(llvmWriter, type.IsPrimitiveType() && !type.UseAsClass),
LlvmWriter.PointerSize
/*Align*/);
}
示例3: CreateValue
public static Value CreateValue(Thread evalThread, object value, IType type = null)
{
if (value == null) {
ICorDebugClass corClass = evalThread.AppDomain.ObjectType.ToCorDebug().GetClass();
ICorDebugEval corEval = evalThread.CorThread.CreateEval();
ICorDebugValue corValue = corEval.CreateValue((uint)CorElementType.CLASS, corClass);
return new Value(evalThread.AppDomain, corValue);
} else if (value is string) {
return Eval.NewString(evalThread, (string)value);
} else {
if (type == null)
type = evalThread.AppDomain.Compilation.FindType(value.GetType());
if (!type.IsPrimitiveType() && type.Kind != TypeKind.Enum)
throw new DebuggerException("Value must be primitve type. Seen " + value.GetType());
Value val = Eval.NewObjectNoConstructor(evalThread, type);
val.SetPrimitiveValue(evalThread, value);
return val;
}
}