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

C# TypeName类代码示例

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

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



TypeName类属于命名空间,在下文中一共展示了TypeName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TypeOf

        public NamedType TypeOf(TypeName name)
        {
            if (!types.ContainsKey(name))
            {
                if (name.Name == typeof(IEnumerable<>).QualifiedName())
                {
                    var itemType = TypeOf(name.GenericArguments.Single());
                    if (itemType == null)
                        return null;
                    types.Add(name, NamedType.Enumerable(itemType));
                }
                else if (name.Name == typeof(Vector<>).QualifiedName())
                {
                    var itemType = TypeOf(name.GenericArguments.Single());
                    if (itemType == null)
                        return null;
                    types.Add(name, NamedType.Vector(itemType));
                }
                else if (name.Name == typeof(Nullable<>).QualifiedName())
                {
                    var itemType = TypeOf(name.GenericArguments.Single());
                    if (itemType == null)
                        return null;
                    types.Add(name, NamedType.Nullable(itemType));
                }
                else
                {
                    return null;
                }
            }

            return types[name];
        }
开发者ID:plioi,项目名称:rook,代码行数:33,代码来源:TypeRegistry.cs


示例2: ProgressGatherStat

        public void ProgressGatherStat(TypeName typeName)
        {
            if(_gatherSkillCollection[typeName] > 300)
                return;

            _gatherSkillCollection[typeName]++;
        }
开发者ID:CadeLaRen,项目名称:TeraEmulator,代码行数:7,代码来源:PlayerCraftStats.cs


示例3: Add

        public void Add(Class @class)
        {
            var typeName = new TypeName(@class.Name.Identifier);

            types[typeName] = new NamedType(@class);
            classes[typeName] = @class;
        }
开发者ID:plioi,项目名称:rook,代码行数:7,代码来源:TypeRegistry.cs


示例4: Jewel

        /// <summary>
        /// instantiate a new Jewel
        /// </summary>
        /// <param name="contentManager">game content manager object</param>
        /// <param name="spriteName">file name of sprite</param>
        /// <param name="position">vector position of Jewel</param>
        public Jewel(
            ContentManager contentManager,
            TypeName type,
            Vector2 position
            )
        {
            _contentManager = contentManager;
            _type = type;
            _position = position;

            // load the jewel image
            if (type == TypeName.Green)
            {
                _sprite = _contentManager.Load<Texture2D>("green_jewel");
            }

            _active = true;

            _spriteWidth = _sprite.Width;
            _spriteHeight = _sprite.Height;

            // set the initial center and bounding rectangle for the player
            _center = new Vector2(position.X + (_spriteWidth / 2), position.Y + (_spriteHeight / 2));
            _boundingRectangle = new Rectangle((int)position.X, (int)position.Y, _spriteWidth, _spriteHeight);
        }
开发者ID:NMC-CIT195,项目名称:Demo_MG_MazeGame,代码行数:31,代码来源:Jewel.cs


示例5: FindByServiceTypeName

        public IList<IComponentDescriptor> FindByServiceTypeName(TypeName serviceTypeName)
        {
            if (serviceTypeName == null)
                throw new ArgumentNullException("serviceTypeName");

            return FindByServiceTypeNameImpl(serviceTypeName);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:Components.cs


示例6: Coin

 public Coin(TypeName name, string description, int value, int countInGameInventory )
 {
     _name = name;
     _description = description;
     _valueInDollars = value;
     _countInGameInventory = countInGameInventory;
 }
开发者ID:NMC-CIT255,项目名称:Demo_Array_PlayerTreasure,代码行数:7,代码来源:Coin.cs


示例7: ResolveType

 public TypeDef ResolveType(TypeName name)
 {
     var typeDef = default(TypeDef);
     if (!nameToTypeDefCache.TryGetValue(name, out typeDef))
         return null;
     return typeDef;
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:7,代码来源:AssemblyDef.cs


示例8: GetByServiceTypeName

        public IServiceDescriptor GetByServiceTypeName(TypeName serviceTypeName)
        {
            if (serviceTypeName == null)
                throw new ArgumentNullException("serviceTypeName");

            return GetByServiceTypeNameImpl(serviceTypeName);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:Services.cs


示例9: ComponentRegistration

 /// <summary>
 /// Creates a component registration.
 /// </summary>
 /// <param name="plugin">The plugin to which the component will belong.</param>
 /// <param name="service">The service implemented by the component.</param>
 /// <param name="componentId">The component id.</param>
 /// <param name="componentTypeName">The component type name, or null to use the default component type specified by the service.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="plugin"/>, <paramref name="service"/>,
 /// <paramref name="componentId"/> is null.</exception>
 public ComponentRegistration(IPluginDescriptor plugin, IServiceDescriptor service, string componentId, TypeName componentTypeName)
 {
     Plugin = plugin;
     Service = service;
     ComponentId = componentId;
     ComponentTypeName = componentTypeName;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:16,代码来源:ComponentRegistration.cs


示例10: FindComponentsByServiceTypeName

        public IList<IComponentDescriptor> FindComponentsByServiceTypeName(TypeName serviceTypeName)
        {
            ServiceDescriptor service = GetServiceByServiceTypeName(serviceTypeName);
            if (service == null)
                return EmptyArray<IComponentDescriptor>.Instance;

            return FindComponentsByServiceId(service.ServiceId);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:RegistryData.cs


示例11: ServiceDescriptor

 public ServiceDescriptor(Registry registry, ServiceRegistration serviceRegistration)
 {
     this.registry = registry;
     pluginDescriptor = (PluginDescriptor) serviceRegistration.Plugin;
     serviceId = serviceRegistration.ServiceId;
     serviceTypeName = serviceRegistration.ServiceTypeName;
     defaultComponentTypeName = serviceRegistration.DefaultComponentTypeName;
     traitsHandlerFactory = serviceRegistration.TraitsHandlerFactory;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:ServiceDescriptor.cs


示例12: RegisterComponentForServices

        private void RegisterComponentForServices(Type type, IPluginDescriptor plugin)
        {
            var componentId = type.FullName;

            var interfaceTypes = GetDirectInterfaces(type);
            var typeName = new TypeName(type).ConvertToPartialAssemblyName();

            RegisterFirstInterface(interfaceTypes, plugin, componentId, typeName);
            RegisterEventHandlers(interfaceTypes, plugin, componentId, typeName);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:10,代码来源:DefaultConventionScanner.cs


示例13: HasValueEqualitySemantics

        public void HasValueEqualitySemantics()
        {
            var type = new TypeName("B", new TypeName("A"));
            type.ShouldEqual(type);
            type.ShouldEqual(new TypeName("B", new TypeName("A")));
            type.ShouldNotEqual(new TypeName("B"));

            type.GetHashCode().ShouldEqual(new TypeName("B", new TypeName("A")).GetHashCode());
            type.GetHashCode().ShouldNotEqual(new TypeName("B").GetHashCode());
        }
开发者ID:plioi,项目名称:rook,代码行数:10,代码来源:TypeNameTests.cs


示例14: ComponentDescriptor

 public ComponentDescriptor(Registry registry, ComponentRegistration componentRegistration)
 {
     this.registry = registry;
     pluginDescriptor = (PluginDescriptor) componentRegistration.Plugin;
     serviceDescriptor = (ServiceDescriptor) componentRegistration.Service;
     componentId = componentRegistration.ComponentId;
     componentTypeName = componentRegistration.ComponentTypeName ?? serviceDescriptor.DefaultComponentTypeName;
     componentProperties = componentRegistration.ComponentProperties.Copy().AsReadOnly();
     traitsProperties = componentRegistration.TraitsProperties.Copy().AsReadOnly();
     componentHandlerFactory = componentRegistration.ComponentHandlerFactory;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:11,代码来源:ComponentDescriptor.cs


示例15: MembersOf

        public Binding[] MembersOf(NamedType type)
        {
            var typeName = new TypeName(type.Name);

            if (!classes.ContainsKey(typeName))
                return new Binding[] { };

            var @class = classes[typeName];

            var result = @class.Methods.Select(m => (Binding)new MethodBinding(m.Name.Identifier, DeclaredType(m))).ToArray();
            //TODO: Cache these results instead of recalculating each time.
            return result;
        }
开发者ID:plioi,项目名称:rook,代码行数:13,代码来源:TypeRegistry.cs


示例16: PluginDescriptor

 public PluginDescriptor(Registry registry, PluginRegistration pluginRegistration, IList<IPluginDescriptor> completePluginDependenciesCopy)
 {
     this.registry = registry;
     pluginId = pluginRegistration.PluginId;
     pluginTypeName = pluginRegistration.PluginTypeName;
     baseDirectory = pluginRegistration.BaseDirectory;
     pluginProperties = pluginRegistration.PluginProperties.Copy().AsReadOnly();
     traitsProperties = pluginRegistration.TraitsProperties.Copy().AsReadOnly();
     pluginHandlerFactory = pluginRegistration.PluginHandlerFactory;
     assemblyBindings = new ReadOnlyCollection<AssemblyBinding>(GenericCollectionUtils.ToArray(pluginRegistration.AssemblyBindings));
     pluginDependencies = new ReadOnlyCollection<IPluginDescriptor>(completePluginDependenciesCopy);
     probingPaths = new ReadOnlyCollection<string>(GenericCollectionUtils.ToArray(pluginRegistration.ProbingPaths));
     enableCondition = pluginRegistration.EnableCondition;
     recommendedInstallationPath = pluginRegistration.RecommendedInstallationPath;
     filePaths = new ReadOnlyCollection<string>(GenericCollectionUtils.ToArray(pluginRegistration.FilePaths));
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:16,代码来源:PluginDescriptor.cs


示例17: Scan

        public void Scan()
        {
            var plugin = registry.Plugins[PluginId];

            var assembly = Assembly.GetExecutingAssembly();

            foreach (var type in assembly.GetTypes())
            {
                if (type.IsInterface || type.IsAbstract)
                    continue;

                var typeName = new TypeName(type).ConvertToPartialAssemblyName();

                RegisterComponentForServices(assembly, type, typeName, plugin);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:16,代码来源:ComponentScanner.cs


示例18: BuildName

		private TypeName BuildName(string name, TypeName[] genericTypes)
		{
			var typeStartsHere = name.LastIndexOf('.');
			string typeName;
			string @namespace = null;

			if (typeStartsHere > -1 && typeStartsHere < (name.Length - 1))
			{
				typeName = name.Substring(typeStartsHere + 1);
				@namespace = name.Substring(0, typeStartsHere);
			}
			else
			{
				typeName = name;
			}
			return new TypeName(@namespace, typeName, genericTypes);
		}
开发者ID:gschuager,项目名称:Castle.Windsor,代码行数:17,代码来源:TypeNameParser.cs


示例19: RegisterFirstInterface

        private void RegisterFirstInterface(IEnumerable<Type> interfaceTypes, IPluginDescriptor plugin, 
            string componentId, TypeName typeName)
        {
            foreach (var interfaceType in interfaceTypes)
            {
                if (IsOpenGenericType(interfaceType))
                    return;

                if (ComponentIsAlreadyRegisteredForService(interfaceType, typeName))
                    return;

                var serviceDescriptor = GetServiceDescriptor(interfaceType, plugin);
                RegisterComponent(componentId, typeName, plugin, serviceDescriptor);
                
                return;
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:17,代码来源:DefaultConventionScanner.cs


示例20: TypeNameClone

        public void TypeNameClone()
        {
            TypeName tn = new TypeName()
            {
                Namespace = "SurveyEngine.DataTypeConverters",
                Name = "CalendarQuestionConstraintType",
                Assembly = "SurveyEngine.DataTypeConverters",
                Version = new Version("2.3.5.2"),
                Culture = "neutral",
                PublicKeyToken = "79cd5921ea88a364"
            };

            TypeName clone = tn.Clone();
            Assert.IsFalse(object.ReferenceEquals(tn, clone));
            Assert.AreEqual(tn.Assembly, clone.Assembly);
            Assert.AreEqual(tn.Culture, clone.Culture);
            Assert.AreEqual(tn.Name, clone.Name);
            Assert.AreEqual(tn.Namespace, clone.Namespace);
            Assert.AreEqual(tn.PublicKeyToken, clone.PublicKeyToken);
            Assert.AreEqual(tn.Version, clone.Version);
        }
开发者ID:ChadBurggraf,项目名称:llblgenprojectupdatetask,代码行数:21,代码来源:TypeNameTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TypeNameHandling类代码示例发布时间:2022-05-24
下一篇:
C# TypeMemberModifiers类代码示例发布时间: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