| name | csharp-style |
|---|---|
| description | Use for folder placement, namespaces, naming consistency, and multi-target framework rules in Contentstack.Utils. |
- Adding new types to the library or tests.
- Choosing namespaces and file locations to match existing structure.
- Ensuring changes remain compatible with netstandard2.0 and desktop TFMs.
Under Contentstack.Utils/, place new code according to its role:
| Folder | Contents |
|---|---|
Interfaces/ |
IEntryEmbedable.cs (IEntryEmbedable); IEmbeddedObject.cs (IEmbeddedObject, IEmbeddedEntry, EditableEntry, IEmbeddedAsset); IOptions.cs (IRenderable, NodeChildrenCallBack); IEdges.cs (IEdges<T>). |
Models/ |
DTOs and Options.cs (Options base class). |
Enums/ |
MarkType, StyleType, EmbedItemType. |
Extensions/ |
Extension methods — HtmlDocumentExtension.cs (FindEmbeddedObject on HtmlAgilityPack HtmlDocument). |
Converters/ |
Newtonsoft.Json converters for RTE/node JSON (NodeJsonConverter.cs, RTEJsonConverter.cs). |
Constants/ |
Shared strings — ErrorMessages.cs. |
- Mirror the folder structure:
Contentstack.Utils.Interfaces,Contentstack.Utils.Models, and so on. KeepContentstack.Utilsas the root for public surface consistency.
- The codebase mixes typical .NET PascalCase for most public members with some camelCase public static names (notably
addEditableTagsonUtils). For new code, prefer consistency with the nearest existing API in the same class or feature area rather than blindly applying IDE defaults, so consumers see uniform style per subsystem.
- Library (
Contentstack.Utils.csproj): netstandard2.0, net47, net472. Public APIs must be implementable on all targets; avoid APIs that only compile on .NET 5+ unless you intentionally raise baselines with a major version policy. - Tests (
Contentstack.Utils.Tests.csproj): net7.0 only—fine for test-only APIs; do not assume test-only APIs exist in the library.