本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}