Skip to the content.

< Back


MyClass

Namespace: MyClassLib

My class.

public class MyClass : IMyInterface

Inheritance ObjectMyClass
Implements IMyInterface
Attributes NullableContextAttribute, NullableAttribute, RequiredMemberAttribute

Remarks:

A remark.

Fields

myField

My field.

public int myField;

myRequiredField

A required field.

public required int myRequiredField;

myProtectedField

My field.

protected int myProtectedField;

Properties

MyProperty

My property.

public string MyProperty { get; protected set; }

Property Value

String
The property value. Used by MyClass.DoGeneric<T>(T).

Example

This example assign "foo" to MyProperty.

foo.MyProperty = "foo";

MyNullableProperty

My nullable property

public int? MyNullableProperty { get; set; }

Property Value

Int32?
The nullable property value.

MyEnum

My enum

public MyEnum MyEnum { get; set; }

Property Value

MyEnum
The enum value

MyInitProperty

An init-only property.

public string MyInitProperty { get; init; }

Property Value

String
The initialization value.

MyRequiredProperty

A required property.

public required string MyRequiredProperty { get; set; }

Property Value

String
The required value.

MyProtectedProperty

My property.

protected string MyProtectedProperty { get; set; }

Property Value

String
The property value. Used by MyClass.ProtectedDoGeneric<T>(T).

MyProtectedEnum

My enum

protected MyEnum MyProtectedEnum { get; set; }

Property Value

MyEnum
The enum value

Constructors

MyClass()

Initializes a new instance of the MyClass class.

public MyClass()

Remarks:

See also MyClass.MyClass(String, Int32).

if (true)
{
    var foo = new MyClass("foo", 1);
    Console.WriteLine(foo.ToString());
}

MyClass(String, Int32)

Initializes a new instance of the MyClass class.
Use firstParam and secondParam.

public MyClass(string firstParam, int secondParam)

Parameters

firstParam String
The first param.

secondParam Int32
The second param.

MyClass(Int32)

Initializes a new instance of the MyClass class.

protected MyClass(int int)

Parameters

int Int32

Methods

Do(String, Int32)

Do some thing.

public void Do(string firstParam, int secondParam)

Parameters

firstParam String
The first param.

secondParam Int32
The second param.

Exceptions

Exception
Thrown when…

DoGeneric<T>(T)

Do some thing.

public int DoGeneric<T>(T value)

Type Parameters

T
The type argument. Used by MyClass.DoGeneric<T>(T).

Parameters

value T
The param. Used by MyClass.DoGeneric<T>(T).

Returns

Int32
Returns a value Int32.

Exceptions

ArgumentException
Thrown instead of Exception.

Get(List<String>)

Gets some thing.

public string Get(List<string> param)

Parameters

param List<String>
The param.

Returns

String
An empty string.

Exceptions

Exception
Thrown when…

Example

This example call the Get method.

var bar = foo.Get("bar");

StaticMethod()

A static method. Referenced by Nested.

public static void StaticMethod()

DoAsync()

An asynchronous operation.

public async Task DoAsync()

Returns

Task
A task that completes when the operation finishes.

Counts(IDictionary<String, Int32>)

Counts entries.

public int Counts(IDictionary<string, int> input)

Parameters

input IDictionary<String, Int32>
A dictionary input.

Returns

Int32
The total count.

ConfigureDb(DbContextOptionsBuilder)

Configures EF Core. See Microsoft.EntityFrameworkCore.DbContextOptionsBuilder.

public void ConfigureDb(DbContextOptionsBuilder builder)

Parameters

builder DbContextOptionsBuilder
The options builder.

ParseJson(String)

Parses JSON. See Newtonsoft.Json.Linq.JObject.

public JObject? ParseJson(string json)

Parameters

json String
The JSON payload.

Returns

JObject?
The parsed object.

ProtectedDo(String, Int32)

Do some thing.

protected void ProtectedDo(string firstParam, int secondParam)

Parameters

firstParam String
The first param.

secondParam Int32
The second param.

Exceptions

Exception
Thrown when…

ProtectedDoGeneric<T>(T)

Do some thing.

protected int ProtectedDoGeneric<T>(T value)

Type Parameters

T
The type argument. Used by MyClass.ProtectedDoGeneric<T>(T).

Parameters

value T
The param. Used by MyClass.ProtectedDoGeneric<T>(T).

Returns

Int32
Returns a value Int32.

Exceptions

ArgumentException
Thrown instead of Exception.

ProtectedGet(List<String>)

Gets some thing.

protected string ProtectedGet(List<string> param)

Parameters

param List<String>
The param.

Returns

String
An empty string.

Exceptions

Exception
Thrown when…

ProtectedStaticMethod()

A static method.

protected static void ProtectedStaticMethod()

Events

MyEvent

My event.

public event EventHandler<EventArgs>? MyEvent;

MyProtectedEvent

My event.

protected event EventHandler<EventArgs>? MyProtectedEvent;

Example

var foo = new MyClass("one", 2);

foo.Do("one", 2);

< Back