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. More...
bool | TryGetValue (string fieldName, out object result)
| Gets the value the specified field name. More...
object | GetValue (int fieldPos)
| Returns the value of the field with the given position. More...
void | Add (int fieldPos, object fieldValue)
| Adds the value in the specified field position. More...
bool | TryGetValue (int fieldPos, out object result)
| Gets the value in the specified field position. 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

  schema | Schema for this record.

## Member Function Documentation

## ◆ Add() [1/2]

void Avro.Generic.GenericRecord.Add | ( | int | fieldPos,
|  | object | fieldValue
| ) |  |

Adds the value in the specified field position.

Parameters

  fieldPos | Position of the field.
  fieldValue | The value to add.

Exceptions

  IndexOutOfRangeException | fieldPos .

## ◆ Add() [2/2]

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.

Parameters

  fieldName | Name of the field.
  fieldValue | Value of the field.

Exceptions

  AvroException | fieldName does not exist in this record.

## ◆ GetValue()

object Avro.Generic.GenericRecord.GetValue | ( | int | fieldPos | ) |
| inline

Returns the value of the field with the given position.

Parameters

  fieldPos | The position of the field.

Returns
  Value of the field with the given position.

Exceptions

  IndexOutOfRangeException | fieldPos

## ◆ TryGetValue() [1/2]

bool Avro.Generic.GenericRecord.TryGetValue | ( | int | fieldPos,
|  | out object | result
| ) |  |
| inline

Gets the value in the specified field position.

Parameters

  fieldPos | Position of the field.
  result | When this method returns true, contains the value of the specified field; otherwise, null.

Returns
  True if the field position is valid.

## ◆ TryGetValue() [2/2]

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

Gets the value the specified field name.

Parameters

  fieldName | Name of the field.
  result | When 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.

## 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

  fieldName | Name of the field.

Returns
  Value of the field with the given name.

Exceptions

  ArgumentNullException | fieldName is null.
  KeyNotFoundException | fieldName does not exist in this record.

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

- src/apache/main/Generic/GenericRecord.cs