• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IType的典型用法代码示例。如果您正苦于以下问题:C# IType类的具体用法?C# IType怎么用?C# IType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IType类属于命名空间,在下文中一共展示了IType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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";
		}
开发者ID:95ulisse,项目名称:ILEdit,代码行数:10,代码来源:NullableType.cs


示例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);
 }
开发者ID:jensweller,项目名称:Catel,代码行数:7,代码来源:DotNetType.cs


示例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;
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:30,代码来源:ImportSymbolHandler.cs


示例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;
        }
开发者ID:prodot,项目名称:ReCommended-Extension,代码行数:31,代码来源:CollectionAllItemsNotNull.cs


示例5: BoundBinaryExpression

 public BoundBinaryExpression(BoundExpression left, BoundExpression right, BinaryOperators @operator, BinaryExpressionSyntax binaryExpressionSyntax, IType type)
     : base(binaryExpressionSyntax, type)
 {
     Left = left;
     Right = right;
     Operator = @operator;
 }
开发者ID:lawl-dev,项目名称:Kiwi,代码行数:7,代码来源:BoundBinaryExpression.cs


示例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");
		}
开发者ID:ols,项目名称:Castle.Facilities.NHibernate,代码行数:7,代码来源:ValidationError_OnSave.cs


示例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();
            }
        }
开发者ID:Didox,项目名称:MVC_e_Velocit_app,代码行数:33,代码来源:Operacao.cs


示例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;
 }
开发者ID:akhuang,项目名称:NHibernateTest,代码行数:7,代码来源:FilterDefinition.cs


示例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;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:41,代码来源:IncrementGenerator.cs


示例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;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:7,代码来源:MemberResolveResult.cs


示例11: ClassEntry

		public ClassEntry (IType cls, NamespaceEntry namespaceRef)
		{
			this.cls = cls;
			this.namespaceRef = namespaceRef;
			position = -1;
			UpdateContent (cls);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:ClassEntry.cs


示例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;
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:25,代码来源:ArrayFinder.cs


示例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]);
				}
			}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:12,代码来源:ForeignKeys.cs


示例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));
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:33,代码来源:SynthesizedSingleDimArrayIListGetEnumeratorMethod.cs


示例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;
		}
开发者ID:Chertolom,项目名称:monodevelop,代码行数:32,代码来源:SignatureMarkupCreator.cs


示例16: CreateEventCreationCompletionData

 public ICompletionData CreateEventCreationCompletionData(string varName, IType delegateType, IEvent evt,
                                                          string parameterDefinition,
                                                          IUnresolvedMember currentMember,
                                                          IUnresolvedTypeDefinition currentType)
 {
     return new CompletionData(varName);
 }
开发者ID:CSRedRat,项目名称:Omnisharp,代码行数:7,代码来源:CompletionDataFactory.cs


示例17: CreateTooltip

		public static FlowDocument CreateTooltip(IType type, bool useFullyQualifiedMemberNames = true)
		{
			var ambience = AmbienceService.GetCurrentAmbience();
			ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowDeclaringType;
			if (useFullyQualifiedMemberNames)
				ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedMemberNames;
			string header;
			if (type is ITypeDefinition)
				header = ambience.ConvertEntity((ITypeDefinition)type);
			else
				header = ambience.ConvertType(type);
			
			ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
			DocumentationUIBuilder b = new DocumentationUIBuilder(ambience);
			b.AddCodeBlock(header, keepLargeMargin: true);
			
			ITypeDefinition entity = type.GetDefinition();
			if (entity != null) {
				var documentation = XmlDocumentationElement.Get(entity);
				if (documentation != null) {
					foreach (var child in documentation.Children) {
						b.AddDocumentationElement(child);
					}
				}
			}
			return b.CreateFlowDocument();
		}
开发者ID:ratoy,项目名称:SharpDevelop,代码行数:27,代码来源:XmlDocFormatter.cs


示例18: MakeIteratorBody

		private JsBlockStatement MakeIteratorBody(IteratorStateMachine sm, bool returnsIEnumerable, IType yieldType, string yieldResultVariable, IList<string> methodParameterNames) {
			var body = new List<JsStatement>();
			body.Add(JsStatement.Var(new[] { JsStatement.Declaration(yieldResultVariable, null) }.Concat(sm.Variables)));
			body.AddRange(sm.FinallyHandlers.Select(h => JsStatement.Var(h.Item1, h.Item2)));
			body.Add(JsStatement.Return(_runtimeLibrary.MakeEnumerator(yieldType,
			                                                           JsExpression.FunctionDefinition(new string[0], sm.MainBlock),
			                                                           JsExpression.FunctionDefinition(new string[0], JsStatement.Return(JsExpression.Identifier(yieldResultVariable))),
			                                                           sm.Disposer != null ? JsExpression.FunctionDefinition(new string[0], sm.Disposer) : null,
			                                                           this)));
			if (returnsIEnumerable) {
				body = new List<JsStatement> {
				    JsStatement.Return(_runtimeLibrary.MakeEnumerable(
				        yieldType,
				        JsExpression.FunctionDefinition(new string[0],
				            JsStatement.Return(
				                JsExpression.Invocation(
				                    JsExpression.Member(
				                        JsExpression.FunctionDefinition(methodParameterNames, JsStatement.Block(body)),
				                        "call"),
				                    new JsExpression[] { JsExpression.This }.Concat(methodParameterNames.Select(JsExpression.Identifier))
				                )
				            )
				        ),
				        this
				    ))
				};
			}

			return JsStatement.Block(body);
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:30,代码来源:StatementCompiler.cs


示例19: QueryParameters

		public QueryParameters(IType[] positionalParameterTypes, object[] postionalParameterValues, object optionalObject, string optionalEntityName, object optionalObjectId)
			: this(positionalParameterTypes, postionalParameterValues)
		{
			OptionalObject = optionalObject;
			OptionalId = optionalObjectId;
			OptionalEntityName = optionalEntityName;
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:7,代码来源:QueryParameters.cs


示例20: AddType

		public void AddType (IType type, string shortType)
		{
			if (type == null || string.IsNullOrEmpty (shortType) || usedTypes.Contains (shortType))
				return;
			usedTypes.Add (shortType);
			result.Add (Factory.CreateTypeCompletionData (type, shortType));
		}
开发者ID:N3X15,项目名称:ILSpy,代码行数:7,代码来源:CompletionDataWrapper.cs



注:本文中的IType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITypeConverter类代码示例发布时间:2022-05-24
下一篇:
C# ITwitterListIdentifier类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap