当前位置: 首页>>代码示例>>C#>>正文


C# Type.getType方法代码示例

本文整理汇总了C#中Type.getType方法的典型用法代码示例。如果您正苦于以下问题:C# Type.getType方法的具体用法?C# Type.getType怎么用?C# Type.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type.getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: damageMultiplierToType

 /// <summary>
 /// Returns the damage multiplier to Type t.
 /// </summary>
 /// <returns>The multiplier to type.</returns>
 /// <param name="t">T.</param>
 public double damageMultiplierToType(Type t)
 {
     int i = t.getType ();
     if (type == 1) {
         if (i == 2) {
             return 0.5;
         } else if (i == 3) {
             return 1.5;
         } else {
             return 1d;
         }
     } else if (type == 2) {
         if (i == 3) {
             return 0.5;
         } else if (i == 1) {
             return 1.5;
         } else {
             return 1d;
         }
     } else if (type == 3) {
         if (i == 1){
             return 0.5;
         }else if(i == 2){
             return 1.5;
         } else{
             return 1d;
         }
     }else{
         return 1d;
     }
 }
开发者ID:wroel,项目名称:MinorProjectGr8,代码行数:36,代码来源:Type.cs

示例2: Read

 /// <summary>
 /// This is used to resolve and load a class for the given element.
 /// Resolution of the class to used is done by inspecting the
 /// XML element provided. If there is a "class" attribute on the
 /// element then its value is used to resolve the class to use.
 /// If no such attribute exists on the element this returns null.
 /// </summary>
 /// <param name="type">
 /// this is the type of the XML element expected
 /// </param>
 /// <param name="node">
 /// this is the element used to resolve an override
 /// </param>
 /// <param name="map">
 /// this is used to maintain contextual information
 /// </param>
 /// <returns>
 /// returns the class that should be used for the object
 /// </returns>
 public Value Read(Type type, NodeMap node, Dictionary map) {
    Class actual = ReadValue(type, node);
    Class expect = type.getType();
    if(expect.isArray()) {
       return ReadArray(actual, node);
    }
    if(expect != actual) {
       return new ObjectValue(actual);
    }
    return null;
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:30,代码来源:TreeStrategy.cs

示例3: Write

 /// <summary>
 /// This is used to attach a attribute to the provided element
 /// that is used to identify the class. The attribute name is
 /// "class" and has the value of the fully qualified class
 /// name for the object provided. This will only be invoked
 /// if the object class is different from the field class.
 /// </summary>
 /// <param name="type">
 /// this is the declared class for the field used
 /// </param>
 /// <param name="value">
 /// this is the instance variable being serialized
 /// </param>
 /// <param name="node">
 /// this is the element used to represent the value
 /// </param>
 /// <param name="map">
 /// this is used to maintain contextual information
 /// </param>
 /// <returns>
 /// this returns true if serialization is complete
 /// </returns>
 public bool Write(Type type, Object value, NodeMap node, Dictionary map) {
    Class actual = value.getClass();
    Class expect = type.getType();
    Class real = actual;
    if(actual.isArray()) {
       real = WriteArray(expect, value, node);
    }
    if(actual != expect) {
       node.put(label, real.getName());
    }
    return false;
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:34,代码来源:TreeStrategy.cs

示例4: ReadValue

 /// <summary>
 /// This is used to resolve and load a class for the given element.
 /// Resolution of the class to used is done by inspecting the
 /// XML element provided. If there is a "class" attribute on the
 /// element then its value is used to resolve the class to use.
 /// If no such attribute exists the specified field is returned,
 /// or if the field type is an array then the component type.
 /// </summary>
 /// <param name="type">
 /// this is the type of the XML element expected
 /// </param>
 /// <param name="node">
 /// this is the element used to resolve an override
 /// </param>
 /// <returns>
 /// returns the class that should be used for the object
 /// </returns>
 public Class ReadValue(Type type, NodeMap node) {
    Node entry = node.remove(label);
    Class expect = type.getType();
    if(expect.isArray()) {
       expect = expect.getComponentType();
    }
    if(entry != null) {
       String name = entry.getValue();
       expect = loader.Load(name);
    }
    return expect;
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:29,代码来源:TreeStrategy.cs

示例5: Write

 public void Write(Type type, NodeMap<OutputNode> node) {
    if(!node.getNode().isRoot()) {
       node.getNode().setComment(type.getType().getName());
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:5,代码来源:ValidationTestCase.cs

示例6: Read

 public void Read(Type type, NodeMap<InputNode> node) {
    InputNode element = node.getNode();
    if(element.isRoot()) {
       Object source = element.getSource();
       Class sourceType = source.getClass();
       Class itemType = type.getType();
       System.out.printf(">>>>> ELEMENT=[%s]%n>>>>> TYPE=[%s]%n>>>>> SOURCE=[%s]%n", element, itemType, sourceType);
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:9,代码来源:ValidationTestCase.cs


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