Avro C#
Public Member Functions | Properties | List of all members
Avro.Generic.GenericRecord Class Reference

The default type used by GenericReader and GenericWriter for RecordSchema. More...

Inheritance diagram for Avro.Generic.GenericRecord:

Public Member Functions

 GenericRecord (RecordSchema schema)
 Initializes a new instance of the GenericRecord class. More...
 
void Add (string fieldName, object fieldValue)
 Sets the value for a field. You may call this method multiple times with the same field name to change its value. The given field name must exist in the schema. This method does not ensure that the given field value is compatible with the field's schema. More...
 
bool TryGetValue (string fieldName, out object result)
 Gets the value the specified field name. More...
 
override bool Equals (object obj)
 
bool Equals (GenericRecord other)
 
override int GetHashCode ()
 
override string ToString ()
 

Properties

RecordSchema Schema [get]
 Schema for this record. More...
 
object this[string fieldName] [get]
 Returns the value of the field with the given name. More...
 

Detailed Description

The default type used by GenericReader and GenericWriter for RecordSchema.

Constructor & Destructor Documentation

◆ GenericRecord()

Avro.Generic.GenericRecord.GenericRecord ( RecordSchema  schema)
inline

Initializes a new instance of the GenericRecord class.

Parameters
schemaSchema for this record.

Member Function Documentation

◆ Add()

void Avro.Generic.GenericRecord.Add ( string  fieldName,
object  fieldValue 
)
inline

Sets the value for a field. You may call this method multiple times with the same field name to change its value. The given field name must exist in the schema. This method does not ensure that the given field value is compatible with the field's schema.

Parameters
fieldNameName of the field.
fieldValueValue of the field.
Exceptions
AvroExceptionfieldName does not exist in this record.

◆ TryGetValue()

bool Avro.Generic.GenericRecord.TryGetValue ( string  fieldName,
out object  result 
)
inline

Gets the value the specified field name.

Parameters
fieldNameName of the field.
resultWhen this method returns true, contains the value of the specified field; otherwise, null.
Returns
True if the field was found in the record. This method will only return true if Add(string, object) has been called for the given field name. This method cannot be used to determine whether or not the schema has a field with a given name.

Property Documentation

◆ Schema

RecordSchema Avro.Generic.GenericRecord.Schema
get

Schema for this record.

◆ this[string fieldName]

object Avro.Generic.GenericRecord.this[string fieldName]
get

Returns the value of the field with the given name.

Parameters
fieldNameName of the field.
Returns
Value of the field with the given name.
Exceptions
ArgumentNullExceptionfieldName is null.
KeyNotFoundExceptionfieldName does not exist in this record.

The documentation for this class was generated from the following file: