I have the following type:
and ListInfo() =
let mutable count = 0
// This is a mutable option because we can't have an infinite data structure.
let mutable lInfo : Option<ListInfo> = None
let dInfo = new DictInfo()
let bInfo = new BaseInfo()
member this.BaseInfo = bInfo
member this.DictInfo = dInfo
member this.LInfo
with get() = lInfo
and set(value) = lInfo <- Some(value)
member this.Count
with get() = count
and set(value) = count <- value
where the recursive "list info" is an Option. Either there is one or there is none. I need to use this from C# but I get errors. This is a sample usage:
if (FSharpOption<Types.ListInfo>.get_IsSome(listInfo.LInfo))
{
Types.ListInfo subListInfo = listInfo.LInfo.Value;
HandleListInfo(subListInfo, n);
}
here listInfo is of the type ListInfo as above. I'm just trying to check if it contains a value and if so I want to use it. But all the accesses listInfo.LInfo gives the error "Property, indexer or event listInfo.LInfo is not supported by the language..."
Anyone that understands why?
The most common one is newline \n , but there are others. Many of them became less and less useful over time, such as \f . This is called form feed, is used to indicate to a printer that it should start a new page.
“F-strings provide a way to embed expressions inside string literals, using a minimal syntax. It should be noted that an f-string is really an expression evaluated at run time, not a constant value. In Python source code, an f-string is a literal string, prefixed with f , which contains expressions inside braces.
To create an f-string, prefix the string with the letter “ f ”. The string itself can be formatted in much the same way that you would with str. format(). F-strings provide a concise and convenient way to embed python expressions inside string literals for formatting.
For example, "print %d" % (3.78) # This would output 3 num1 = 5 num2 = 10 "%d + %d is equal to %d" % (num1, num2, num1 + num2) # This would output # 5 + 10 is equal to 15. The %f formatter is used to input float values, or numbers with values after the decimal place.
I suspect the problem is the LInfo
property getter/setter work with different types (which isn't supported in C#).
Try this
member this.LInfo
with get() = lInfo
and set value = lInfo <- value
Or this
member this.LInfo
with get() = match lInfo with Some x -> x | None -> Unchecked.defaultof<_>
and set value = lInfo <- Some value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With