Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[C#]Properties mit Parametern

Empfohlene Antworten

Veröffentlicht

Grüße,

ein Vorteil von VB.Net ist, dass man Properties mit Parametern aufrufen kann, z.B.:


    Public Property Mx(ByVal unit As MeasurementUnit(Of PointMoment)) As Double

        Get

            Return _Mx(unit)

        End Get

        Set(ByVal value As Double)

            If _Mx(unit) <> value Then

                _Mx(unit) = value

                OnPropertyChanged("Mx")

            End If

        End Set

    End Property

Was genau hinter den Variablen steckt, ist egal, nur ein Beispiel... Daher frag ich mich, ob sowas auch mit C# gehen würde. Ich hab schon rausgefunden, dass es mit der Default-Property geht:

    public interface IGeometryHeigth : IGeometry

    {

        double this[string unit] {set;}

    }

jetzt ist nur die Frage, wenn ich eine Instanz hab, kann ich in dieser Klasse auch andere Properties (keine überladene default-Property) deklarieren, die auch Parameter verwendet?

    public interface IGeometryHeigth : IGeometry

    {

        double this[string unit] {set;}

        double Value1[string unit] { set; }

    }

... mag mein Compiler irgendwie nicht:

Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.

Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)

Invalid expression term 'string'

Invalid token ']' in class, struct, or interface member declaration

Invalid token ';' in class, struct, or interface member declaration

Type or namespace definition, or end-of-file expected

Bin dankbar für Vor- oder Abschläge. :hells:

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.