{"id":13340227,"url":"https://github.com/konfiger/konfiger-dotnet","last_synced_at":"2026-02-25T08:38:36.763Z","repository":{"id":37531498,"uuid":"210735003","full_name":"konfiger/konfiger-dotnet","owner":"konfiger","description":"Light weight package to manage key value based configuration and data files for .NET Notable C# and Visual Basic.","archived":false,"fork":false,"pushed_at":"2020-01-23T12:00:21.000Z","size":54,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T08:56:46.057Z","etag":null,"topics":["configuration","csharp","dotnet","key-value","langauge","parser","properties","visual-basic"],"latest_commit_sha":null,"homepage":"https://301s.github.io/?kd","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/konfiger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-25T02:05:28.000Z","updated_at":"2022-06-21T17:27:53.000Z","dependencies_parsed_at":"2022-08-19T04:50:43.090Z","dependency_job_id":null,"html_url":"https://github.com/konfiger/konfiger-dotnet","commit_stats":null,"previous_names":["keyvaluedb/key-value-db-csharp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/konfiger/konfiger-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konfiger%2Fkonfiger-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konfiger%2Fkonfiger-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konfiger%2Fkonfiger-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konfiger%2Fkonfiger-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/konfiger","download_url":"https://codeload.github.com/konfiger/konfiger-dotnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konfiger%2Fkonfiger-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29815024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","csharp","dotnet","key-value","langauge","parser","properties","visual-basic"],"created_at":"2024-07-29T19:22:14.813Z","updated_at":"2026-02-25T08:38:36.746Z","avatar_url":"https://github.com/konfiger.png","language":"C#","funding_links":["https://www.patreon.com/devcareer"],"categories":[],"sub_categories":[],"readme":"# \u003cp style=\"text-align: center;\" align=\"center\"\u003e\u003cimg src=\"https://github.com/keyvaluedb/keyvaluedb.github.io/raw/master/icons/key-value-db-csharp.png\" alt=\"key-value-db-csharp\" style=\"width:180px;height:160px;\" width=\"180\" height=\"160\" /\u003e\u003cbr /\u003e key-value-db-csharp\u003c/p\u003e\n\n\u003cp style=\"text-align: center;\" align=\"center\"\u003eLight weight package to quickly and easily manage, load, update and save key-value type database \u003c/p\u003e\n\n---\n\nThe sample use cases of this package is loading configuration file, language file, preference setting in an application. More use cases can be seen [here](https://keyvaluedb.github.io/usecases/index.html).\n\nThe package does not do any Input and Output operation as there are several way to read and write to file and the methods has their strength and weakness therefore the developer has to find the efficient way to load and save locally.\n\n___\n\n## Table of content\n- [Installation](#installation)\n- [Example](#example)\n- [Legends](#legends)\n- [API](#api)\n\t- [Creating/loading a document](#creating/loading-a-document)\n\t- [Inserting data](#inserting-data)\n\t- [Finding data](#finding-data)\n\t    - [Get KeyValue Object](#get-keyvalue-object)\n\t    - [Get Like KeyValue Object](#get-like-keyvalue-object)\n\t    - [Get](#get)\n\t    - [Get Like](#get-like)\n\t- [Updating data](#updating-data)\n        - [Set](#set)\n        - [Set KeyValue Object](#set-keyvalue-object)\n\t- [Inserting data](#inserting-data)\n\t- [Removing data](#removing-data)\n\t- [Size, Clear, IsEmpty](#size,-clear,-isempty)\n        - [Size](#size)\n        - [Clear](#clear)\n        - [IsEmpty](#isempty)\n    - [Saving collection](#saving-collection)\n    - [Iterating collection](#iterating-collection)\n- [How it works](#how-it-works)\n- [Contributing](#contributing)\n- [Support](#support)\n- [License](#license)\n\n## Installation\n\nPackage name is KeyValueDB.\n\nUsing Package-Manager:\n\n```bash\nInstall-Package KeyValueDB -Version 1.2.0\n```\n\nUsing .NET CLI:\n\n```bash\ndotnet add package KeyValueDB --version 1.2.0\n```\n\nUsing Pakage Reference:\n\n```xml\n\u003cPackageReference Include=\"KeyValueDB\" Version=\"1.2.0\" /\u003e\n```\n\nUsing Packet CLI:\n\n```xml\npaket add KeyValueDB --version 1.2.0\n```\n\n## Example\n\nThe following example load, update, read and remove a simple key value object \n\n```csharp\nusing System;\nusing Io.Github.Thecarisma;\n\nnamespace Sample\n{\n    class Test \n    {\n        public static void Main(string[] args)\n        {\n            //initialize the key-value \n            KeyValueDB keyValueDB = new KeyValueDB(\"Greet=Hello World,Project=KeyValueDB\", true, '=', ',', false);\n\n            //get an object\n            Console.WriteLine(keyValueDB.Get(\"Greet\"));\n\n            //remove an object\n            keyValueDB.Remove(\"Greet\");\n\n            //add an object\n            keyValueDB.Add(\"What\", \"i don't know what to write here\");\n\n            //print all the objects\n            foreach (var kvo in keyValueDB) {\n                Console.WriteLine(kvo);\n            }\n        }\n    }\n}\n\n```\n\n## Legends\n\n```\nkvp  - Key Value Pair\nkvdb - Key value Database\npss  - Possibly\nkvo  - Key Value Object\n```\n\n## API\n\nOnly string type is used as the key and value of the kvo. A kvo can be used to replace or set the value for a key.\n\n### Creating/loading a document\n\nYou can use the package to update and create an existing key value database. This library does not read the database from a file which means you have to find a way to read a string from the file. \n\nCreate a new keyValueDB. The default seperator between the key and value is `=` and the delimeter between the kvp is `\\n`(newline).\n\n```csharp\nKeyValueDB keyValueDB = new KeyValueDB();\n```\n\nTo load existing KeyValueDB  \n\n```csharp\nKeyValueDB keyValueDB = new KeyValueDB(\n        \"Greet=Hello World,Project=KeyValueDB\", //pss read string from file\n        true, //case sensitive is true\n        '=', //the seperator from key and value\n        ',', //the delimeter for the key-value-pair\n        false //error tolerance if true no exception is thrown\n        );\n```\n\n### Inserting Data\n\nThe only accepted type that can be inserted is a valid `KeyValueObject` and `String`. The method `Add` can be used to add a new kvp into the object.\n\nAdd a kvp with it key and value\n\n```csharp\nkeyValueDB.Add(\"Greet\", \"Hello World\");\n```\n\nAdd a kvp using the `KeyValueObject` class.\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Greet\", \"Hello World\");\nkeyValueDB.Add(keyValueObject);\n```\n\n### Finding Data\n\nThere are several way to find and get a value from the kvdb object. The value or the KeyValueObject can be gotten using the methods below\n\n#### Get KeyValue Object\n\nYou can get the kvo using either the key or index. If the corresponding kvo is not found, an empty kvo is added to the db and then returned but not in the case when requested with the integer index. If a fallback kvo is sent as second parameter then when the request kvo is not found the fallback second parameter is added to the kvdb and then returned.\n\nGet the kvo using it integer index\n\n```csharp\nkeyValueDB.GetKeyValueObject(0);\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World\n```\n\nGet the kvo using it key \n\n```csharp\nkeyValueDB.GetKeyValueObject(\"Greet\");\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World\n```\n\nGet the kvo using it key with fallback kvo\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Name\", \"Adewale Azeez\");\nkeyValueDB.GetKeyValueObject(\"Name\", keyValueObject);\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Name,Value=Adewale Azeez\n```\n\n#### Get Like KeyValue Object\n\nGet a kvo by checking the kvdb for the kvo object that contains a part of the key. If a fallback kvo is sent as second parameter then when the request kvo is not found the fallback second parameter is added to the kvdb and then returned.\n\nGet a similar kvo using it key part \n\n```csharp\nkeyValueDB.GetLikeKeyValueObject(\"eet\");\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World\n```\n\nGet a similar kvo using it key part with fallback kvo\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Name\", \"Adewale Azeez\");\nkeyValueDB.getKeyValueObject(\"Nam\", keyValueObject);\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Name,Value=Adewale Azeez\n```\n\n#### Get\n\nYou can get a kvdb value using either the key or index. If the corresponding value is not found, an empty string is added to the db and then returned but not in the case when requested with the integer index. \n\nIf a fallback kvo is sent as second parameter then when the request key is not found the fallback second parameter is added to the kvdb and then value is returned. If a string value is sent as the second value it is returned if the key is not found in the kvdb.\n\nGet a value using it integer index\n\n```csharp\nkeyValueDB.Get(0);\n//\"Hello World\"\n```\n\nGet the value using it key \n\n```csharp\nkeyValueDB.Get(\"Greet\");\n//\"Hello World\"\n```\n\nGet the kvo using it key with fallback value\n\n```csharp\nkeyValueDB.Get(\"Licence\", \"The MIT Licence\");\n//\"The MIT Licence\"\n```\n\nGet the kvo using it key with fallback kvo\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Licence\", \"The MIT Licence\");\nkeyValueDB.Get(\"Name\", keyValueObject);\n//\"The MIT Licence\"\n```\n\n#### Get Like \n\nGet a value by checking the kvdb for the kvo object that contains a part of the key. \n\nIf a fallback kvo is sent as second parameter then when the request key is not found the fallback second parameter is added to the kvdb and then value is returned.\n\nGet a value using it key part \n\n```csharp\nkeyValueDB.GetLike(\"eet\");\n//\"Hello World\"\n```\n\nGet a value using it key part with fallback kvo\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Licence\", \"The MIT Licence\");\nkeyValueDB.GetLike(\"Li\", keyValueObject);\n//\"The MIT Licence\"\n```\n\n### Updating Data\n\nThere are various way to update a kvp in the kvdb, the value can be changed directly or set to a new KeyValueObject. If you try to set a kvo that does not exist in the kvdb using it key, it is added to the kvdb.\n\n#### Set\n\nThe `Set` method is used to change the value of the kvo using the index of the kvo or a kvo key. \n\nSet a kvo value using it index\n\n```csharp\nkeyValueDB.Set(0, \"Hello World from thecarisma\");\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World from thecarisma\n```\n\nSet a kvo value using it key\n\n```csharp\nkeyValueDB.Set(\"Greet\", \"Hello World from thecarisma\");\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World from thecarisma\n```\n\n#### Set KeyValue Object\n\nCompletely change a KeyValueObject in the kvdb using either it index or it key. The kvo is completly replaced which means unique fields like the hashcode of the kvo changes. When the kvo is set using it key if the corresponding kvo does not exist it is added into the kvdb.\nNote that this method completly changes the kvo so it can be used to replace a kvo.\n\nSet a kvo using it index\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Licence\", \"The MIT Licence\");\nkeyValueDB.SetKeyValueObject(0, keyValueObject);\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Licence,Value=The MIT Licence\n```\n\nSet a kvo value using it key\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Licence\", \"The MIT Licence\");\nkeyValueDB.SetKeyValueObject(\"Greet\", keyValueObject);\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Licence,Value=The MIT Licence\n```\n\n### Inserting Data\n\nA new kvp can be inserted by invoking the `Add` method. The kvp can be added using it key and value or by directly adding the KeyValueObject to the kvdb. \n\nAdd a new kvp using the key and value\n\n```csharp\nkeyValueDB.Add(\"Key\", \"This is the value\");\n```\n\nAdd a new kvp using a new KeyValueObject\n\n```csharp\nKeyValueObject keyValueObject = new KeyValueObject(\"Key\", \"This is the value\");\nkeyValueDB.Add(keyValueObject);\n```\n\n### Removing Data\n\nRemove a kvp completely from the kvdb using either it key of the integer index. The kvp that was removed is returned from the method. If the index does not exist out of bound error occur and if a kvo with the key is not present nothing is done but an empty kvo is returned.\n\nRemove a kvp using integer index\n\n```csharp\nkeyValueDB.Remove(0);\n//removes the first kvp in the kvdb\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World\n```\n\nRemove a kvp using it key\n\n```csharp\nkeyValueDB.Remove(\"Greet\");\n//removes the first kvp in the kvdb\n//Io.Github.Thecarisma.KeyValueObject@55915408:Key=Greet,Value=Hello World\n```\n\n## Size, Clear, isEmpty\n\n### Size\n\nGet the size of the kvo in the kvdb.\n\n```csharp\nkeyValueDB.Size();\n//4\n```\n\n### Clear\n\nRemove all the elements and kvo from the kvdb\n\n```csharp\nkeyValueDB.Clear();\n//keyValueDB.Size() = 0\n```\n\n### isEmpty\n\nCheck whether the kvdb contains any kvo in it.\n\n```csharp\nkeyValueDB.IsEmpty();\n//False\n```\n\n## Saving collection\n\nThe kvp collection kvdb can be inspected as a string using the `ToString` method. The returned value can be saved locally by writing to a persistent storage or to a plain text file. The output of the `ToString` method is determined by the kvos, the seperator and the delimeter.\n\n```csharp\nkeyValueDB.ToString();\n// \"Greet=Hello World,Project=KeyValueDB,Project=KeyValueDB,Licence=The MIT Licence\"\n```\n\n## Iterating collection\n\nThe KeyValueDB object can be iterated natively using the `foreach..in` loop expression. \n\n```csharp\nforeach (var kvo in keyValueDB) {\n    //operate on the KeyValueObject\n}\n```\n\n## How it works\n\nKeyValueObject class contains the key and value field and the fields setter and getter. \nThe KeyValueObject is the main internal type used in the KeyValueDB class.\n \nIn KeyValueDB the key value pair is stored in `List\u003cKeyValueObject\u003e` type, all search, \nupdating and removal is done on the `keyValueObjects` in the class. The string sent as \nfirst parameter if parsed into valid key value using the separator and delimiter fields. The \n`ToString` method also parse the `keyValueObjects` content into a valid string with regards to the \nseparator and delimeter. \n\n## Contributing\n\nBefore you begin contribution please read the contribution guide at [CONTRIBUTING GUIDE](https://keyvaluedb.github.io/contributing.html)\n\nYou can open issue or file a request that only address problems in this implementation on this repo, if the issue address the concepts of the package then create an issue or rfc [here](https://github.com/keyvaluedb/keyvaluedb.github.io/)\n\n## Support\n\nYou can support some of this community as they make big impact in the developement of people to get started with software engineering.\n\n- https://www.patreon.com/devcareer\n\n## License\n\nMIT License Copyright (c) 2020 Adewale Azeez - keyvaluedb\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonfiger%2Fkonfiger-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonfiger%2Fkonfiger-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonfiger%2Fkonfiger-dotnet/lists"}