本文整理汇总了C#中IType类的典型用法代码示例。如果您正苦于以下问题:C# IType类的具体用法?C# IType怎么用?C# IType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IType类属于命名空间,在下文中一共展示了IType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsNullable
/// <summary>
/// Gets whether the specified type is a nullable type.
/// </summary>
public static bool IsNullable(IType type)
{
if (type == null)
throw new ArgumentNullException("type");
ParameterizedType pt = type as ParameterizedType;
return pt != null && pt.TypeArguments.Count == 1 && pt.FullName == "System.Nullable";
}
示例2: Equals
public bool Equals(IType type)
{
if (type == null) throw new ArgumentNullException("type");
if (!(type is DotNetType)) throw new ArgumentException("type");
if (_type == null) return false;
return this._type.Equals(((DotNetType)type).Type);
}
示例3: GetResult
public GenerateNamespaceImport GetResult (IUnresolvedFile unit, IType type, MonoDevelop.Ide.Gui.Document doc)
{
GenerateNamespaceImport result;
if (cache.TryGetValue (type.Namespace, out result))
return result;
result = new GenerateNamespaceImport ();
cache[type.Namespace] = result;
TextEditorData data = doc.Editor;
result.InsertNamespace = false;
var loc = new TextLocation (data.Caret.Line, data.Caret.Column);
foreach (var ns in RefactoringOptions.GetUsedNamespaces (doc, loc)) {
if (type.Namespace == ns) {
result.GenerateUsing = false;
return result;
}
}
result.GenerateUsing = true;
string name = type.Name;
foreach (string ns in RefactoringOptions.GetUsedNamespaces (doc, loc)) {
if (doc.Compilation.MainAssembly.GetTypeDefinition (ns, name, type.TypeParameterCount) != null) {
result.GenerateUsing = false;
result.InsertNamespace = true;
return result;
}
}
return result;
}
示例4: IsAvailableForType
protected override bool IsAvailableForType(IType type)
{
var context = Provider.SelectedElement;
Debug.Assert(context != null);
if ((type.IsCollectionLike() || type.IsGenericArray(context)) && !type.IsGenericIEnumerable() && !type.IsArray())
{
var elementType = CollectionTypeUtil.ElementTypeByCollectionType(type, context);
if (elementType != null)
{
if (elementType.Classify == TypeClassification.REFERENCE_TYPE)
{
isDictionary = false;
return true;
}
var declaredType = type as IDeclaredType;
if (declaredType != null &&
(declaredType.GetKeyValueTypesForGenericDictionary() ?? Enumerable.Empty<JetBrains.Util.Pair<IType, IType>>()).Any(
pair => pair.Second.Classify == TypeClassification.REFERENCE_TYPE))
{
isDictionary = true;
return true;
}
}
}
return false;
}
示例5: BoundBinaryExpression
public BoundBinaryExpression(BoundExpression left, BoundExpression right, BinaryOperators @operator, BinaryExpressionSyntax binaryExpressionSyntax, IType type)
: base(binaryExpressionSyntax, type)
{
Left = left;
Right = right;
Operator = @operator;
}
示例6: OnFlushDirty
public bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState,
string[] propertyNames, IType[] types)
{
logger.Debug("throwing validation exception");
throw new ApplicationException("imaginary validation error");
}
示例7: BuscarPorHierarquiaENivel
public LIType BuscarPorHierarquiaENivel(IType iType, int idHierarquia, int idSubNivel, int idCampanha)
{
try
{
Cmd = DataBaseGeneric.CreateCommand(BaseType);
Cmd.Connection = Cn;
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = "Sp_Ambev_Lista_Nivel_Hierarquia_dsPessoa";
DbParameter paran = Cmd.CreateParameter();
paran.ParameterName = "@nivel";
paran.Value = idSubNivel;
Cmd.Parameters.Add(paran);
DbParameter paran1 = Cmd.CreateParameter();
paran1.ParameterName = "@idHierarquiaPai";
paran1.Value = idHierarquia;
Cmd.Parameters.Add(paran1);
DbParameter paran2 = Cmd.CreateParameter();
paran2.ParameterName = "@idcampanha";
paran2.Value = idCampanha;
Cmd.Parameters.Add(paran2);
return MakeListToGet(iType);
}
catch (Exception ex) { throw ex; }
finally
{
Cn.Close();
Cn.Dispose();
}
}
示例8: AddParameter
public FilterDefinition AddParameter(string name, IType type)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentException("The name is mandatory", "name");
if (type == null) throw new ArgumentNullException("type");
parameters.Add(name, type);
return this;
}
示例9: Configure
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="parms"></param>
/// <param name="d"></param>
public void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect d)
{
string tableList;
string column;
string schema;
string catalog;
if (!parms.TryGetValue("tables", out tableList))
parms.TryGetValue(PersistentIdGeneratorParmsNames.Tables, out tableList);
string[] tables = StringHelper.Split(", ", tableList);
if (!parms.TryGetValue("column", out column))
parms.TryGetValue(PersistentIdGeneratorParmsNames.PK, out column);
returnClass = type.ReturnedClass;
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schema);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalog);
StringBuilder buf = new StringBuilder();
for (int i = 0; i < tables.Length; i++)
{
if (tables.Length > 1)
{
buf.Append("select ").Append(column).Append(" from ");
}
buf.Append(Table.Qualify(catalog, schema, tables[i]));
if (i < tables.Length - 1)
buf.Append(" union ");
}
if (tables.Length > 1)
{
buf.Insert(0, "( ").Append(" ) ids_");
column = "ids_." + column;
}
sql = "select max(" + column + ") from " + buf;
}
示例10: MemberResolveResult
public MemberResolveResult(ResolveResult targetResult, IMember member, IType returnType) : base(returnType)
{
if (member == null)
throw new ArgumentNullException("member");
this.targetResult = targetResult;
this.member = member;
}
示例11: ClassEntry
public ClassEntry (IType cls, NamespaceEntry namespaceRef)
{
this.cls = cls;
this.namespaceRef = namespaceRef;
position = -1;
UpdateContent (cls);
}
示例12: GetArray
public static byte[] GetArray(IList<Instruction> instrs, ref int index, out IType type) {
for (int i = index; i < instrs.Count - 2; i++) {
var newarr = instrs[i++];
if (newarr.OpCode.Code != Code.Newarr)
continue;
if (instrs[i++].OpCode.Code != Code.Dup)
continue;
var ldtoken = instrs[i++];
if (ldtoken.OpCode.Code != Code.Ldtoken)
continue;
var field = ldtoken.Operand as FieldDef;
if (field == null || field.InitialValue == null)
continue;
index = i - 3;
type = newarr.Operand as IType;
return field.InitialValue;
}
index = instrs.Count;
type = null;
return null;
}
示例13: NullifyTransientReferences
/// <summary>
/// Nullify all references to entities that have not yet
/// been inserted in the database, where the foreign key
/// points toward that entity
/// </summary>
public void NullifyTransientReferences(object[] values, IType[] types)
{
for (int i = 0; i < types.Length; i++)
{
values[i] = NullifyTransientReferences(values[i], types[i]);
}
}
示例14: SynthesizedSingleDimArrayIListGetEnumeratorMethod
/// <summary>
/// </summary>
/// <param name="type">
/// </param>
/// <param name="typeResolver">
/// </param>
public SynthesizedSingleDimArrayIListGetEnumeratorMethod(IType arrayType, ITypeResolver typeResolver)
: base("GetEnumerator", arrayType, typeResolver.System.System_Collections_Generic_IEnumerator_T.Construct(arrayType.GetElementType()))
{
var codeList = new IlCodeBuilder();
codeList.LoadArgument(0);
codeList.Add(Code.Newobj, 1);
codeList.Add(Code.Newobj, 2);
codeList.Add(Code.Ret);
var locals = new List<IType>();
this._methodBody =
new SynthesizedMethodBodyDecorator(
null,
locals,
codeList.GetCode());
this._parameters = new List<IParameter>();
this._tokenResolutions = new List<object>();
var arraySegmentType = typeResolver.System.System_ArraySegment_T1.Construct(arrayType.GetElementType());
this._tokenResolutions.Add(
IlReader.Constructors(arraySegmentType, typeResolver).First(c => c.GetParameters().Count() == 1));
this._tokenResolutions.Add(
IlReader.Constructors(arraySegmentType.GetNestedTypes().First(), typeResolver).First(c => c.GetParameters().Count() == 1));
}
示例15: GetTypeReferenceString
public string GetTypeReferenceString (IType type, bool highlight = true)
{
if (type == null)
throw new ArgumentNullException ("type");
if (type.Kind == TypeKind.Null)
return "?";
if (type.Kind == TypeKind.Array) {
var arrayType = (ArrayType)type;
return GetTypeReferenceString (arrayType.ElementType, highlight) + "[" + new string (',', arrayType.Dimensions - 1) + "]";
}
if (type.Kind == TypeKind.Pointer)
return GetTypeReferenceString (((PointerType)type).ElementType, highlight) + "*";
AstType astType;
try {
astType = astBuilder.ConvertType (type);
} catch (Exception e) {
var compilation = GetCompilation (type);
if (compilation == null) {
Console.WriteLine ("type:"+type.GetType ());
Console.WriteLine ("got exception while conversion:" + e);
return "?";
}
astType = new TypeSystemAstBuilder (new CSharpResolver (compilation)).ConvertType (type);
}
if (astType is PrimitiveType) {
return Highlight (astType.ToString (formattingOptions), colorStyle.KeywordTypes);
}
var text = AmbienceService.EscapeText (astType.ToString (formattingOptions));
return highlight ? HighlightSemantically (text, colorStyle.UserTypes) : text;
}