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


C# Context.isPrimitive方法代码示例

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


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

示例1: GetConverter

 /// <summary>
 /// This will create a <c>Converter</c> for transforming an XML
 /// element into an array of XML serializable objects. The XML schema
 /// class for these objects must present the element array annotation.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="name">
 /// this is the name of the entry XML element to use
 /// </param>
 /// <returns>
 /// this returns the converter for creating a collection
 /// </returns>
 public Converter GetConverter(Context context, String name) {
    Type entry = Dependent;
    Type type = Contact;
    if(!context.isPrimitive(entry)) {
       return new CompositeArray(context, type, entry, name);
    }
    return new PrimitiveArray(context, type, entry, name);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:22,代码来源:ElementArrayLabel.cs

示例2: GetInlineConverter

 /// <summary>
 /// This will create a <c>Converter</c> for transforming an XML
 /// element into a collection of XML serializable objects. The XML
 /// schema class for these objects must be present the element list
 /// annotation.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <returns>
 /// this returns the converter for creating a collection
 /// </returns>
 public Converter GetInlineConverter(Context context, String name) {
    Type item = Dependent;
    Type type = Contact;
    if(!context.isPrimitive(item)) {
       return new CompositeInlineList(context, type, item, name);
    }
    return new PrimitiveInlineList(context, type, item, name);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:20,代码来源:ElementListLabel.cs

示例3: GetConverter

 //public Decorator GetDecorator() {
 //   return decorator;
 //}
 /// Creates a converter that can be used to transform an XML node to
 /// an object and vice versa. The converter created will handles
 /// only XML elements and requires the context object to be provided.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <returns>
 /// this returns a converter for serializing XML elements
 /// </returns>
 public Converter GetConverter(Context context) {
    Type type = Contact;
    if(context.isPrimitive(type)) {
       return new Primitive(context, type);
    }
    return new Composite(context, type);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:20,代码来源:ElementLabel.cs

示例4: GetConverter

 //public Decorator GetDecorator() {
 //   return null;
 //}
 /// Creates a converter that can be used to transform an XML node to
 /// an object and vice versa. The converter created will handles
 /// only XML text and requires the context object to be provided.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <returns>
 /// this returns a converter for serializing XML elements
 /// </returns>
 public Converter GetConverter(Context context) {
    String ignore = GetEmpty(context);
    Type type = Contact;
    if(!context.isPrimitive(type)) {
       throw new TextException("Cannot use %s to represent %s", label, type);
    }
    return new Primitive(context, type, ignore);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:21,代码来源:TextLabel.cs

示例5: GetValue

 /// <summary>
 /// This is used to get the value converter for the entry. This knows
 /// whether the value type is a primitive or composite object and will
 /// provide the appropriate converter implementation. This allows
 /// the root composite map converter to concern itself with only the
 /// details of the surrounding entry object.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <returns>
 /// returns the converter used for serializing the value
 /// </returns>
 public Converter GetValue(Context context) {
    Type type = ValueType;
    if(context.isPrimitive(type)) {
       return new PrimitiveValue(context, this, type);
    }
    return new CompositeValue(context, this, type);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:20,代码来源:Entry.cs

示例6: GetKey

 /// <summary>
 /// This is used to get the key converter for the entry. This knows
 /// whether the key type is a primitive or composite object and will
 /// provide the appropriate converter implementation. This allows
 /// the root composite map converter to concern itself with only the
 /// details of the surrounding entry object.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <returns>
 /// returns the converter used for serializing the key
 /// </returns>
 public Converter GetKey(Context context) {
    Type type = KeyType;
    if(context.isPrimitive(type)) {
       return new PrimitiveKey(context, this, type);
    }
    return new CompositeKey(context, this, type);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:20,代码来源:Entry.cs


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