本文整理汇总了C#中TypeName类的典型用法代码示例。如果您正苦于以下问题:C# TypeName类的具体用法?C# TypeName怎么用?C# TypeName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeName类属于命名空间,在下文中一共展示了TypeName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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];
}
示例2: ProgressGatherStat
public void ProgressGatherStat(TypeName typeName)
{
if(_gatherSkillCollection[typeName] > 300)
return;
_gatherSkillCollection[typeName]++;
}
示例3: Add
public void Add(Class @class)
{
var typeName = new TypeName(@class.Name.Identifier);
types[typeName] = new NamedType(@class);
classes[typeName] = @class;
}
示例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);
}
示例5: FindByServiceTypeName
public IList<IComponentDescriptor> FindByServiceTypeName(TypeName serviceTypeName)
{
if (serviceTypeName == null)
throw new ArgumentNullException("serviceTypeName");
return FindByServiceTypeNameImpl(serviceTypeName);
}
示例6: Coin
public Coin(TypeName name, string description, int value, int countInGameInventory )
{
_name = name;
_description = description;
_valueInDollars = value;
_countInGameInventory = countInGameInventory;
}
示例7: ResolveType
public TypeDef ResolveType(TypeName name)
{
var typeDef = default(TypeDef);
if (!nameToTypeDefCache.TryGetValue(name, out typeDef))
return null;
return typeDef;
}
示例8: GetByServiceTypeName
public IServiceDescriptor GetByServiceTypeName(TypeName serviceTypeName)
{
if (serviceTypeName == null)
throw new ArgumentNullException("serviceTypeName");
return GetByServiceTypeNameImpl(serviceTypeName);
}
示例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;
}
示例10: FindComponentsByServiceTypeName
public IList<IComponentDescriptor> FindComponentsByServiceTypeName(TypeName serviceTypeName)
{
ServiceDescriptor service = GetServiceByServiceTypeName(serviceTypeName);
if (service == null)
return EmptyArray<IComponentDescriptor>.Instance;
return FindComponentsByServiceId(service.ServiceId);
}
示例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;
}
示例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);
}
示例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());
}
示例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;
}
示例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;
}