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#] Datentyp überprüfen

Empfohlene Antworten

Veröffentlicht

Hi,

Ich versuche gerade eine Datentyp-Abfrage zu ertellen:


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace Typ

{

    class Program

    {

        static void Main(string[] args)

        {

            int something = 7;

            if (something.GetType() == System.Int32)

            {

                Console.WriteLine("Richtig");

            }

            else 

            {

                Console.WriteLine("Falsch");

            }

            Console.ReadLine();

        }

    }

}

Der Compiler beschwert sich wie folgt:

Fehler 1 "int" ist "Typ" und im angegebenen Kontext nicht gültig. C:\Users\Musti_2.Musti-PC\AppData\Local\Temporary Projects\Typ\Program.cs 13 47 Typ

Ich hoffe, ihr könnt mir helfen!

Mit freundlichen Grüßen

mustiwebp

Ich versuche gerade eine Datentyp-Abfrage zu ertellen:


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace Typ

{

    class Program

    {

        static void Main(string[] args)

        {

            int something = 7;

            if (something.GetType() == System.Int32)

            {

                Console.WriteLine("Richtig");

            }

            else 

            {

                Console.WriteLine("Falsch");

            }

            Console.ReadLine();

        }

    }

}

so gehts:

if (something.GetType() == typeof(System.Int32))

oder noch besser:

if (something is System.Int32)

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.