Αποτελέσματα Αναζήτησης
6 Φεβ 2013 · UPDATE: As of C# 6, if you want to use the static members of a class without specifying the class name, you can use the using static directive to import the static members into the current scope, like this: using static MyNamespace.MyClass;
25 Ιαν 2010 · It's not exactly like C's #include directive, but C#'s using statement is what you're after: using Assembly.Name; It works at a namespace level, rather than a file level. So, if class.cs includes a public class named SomeClass in the Application.Core namespace, this would look like: using Application.Core;
C# Objects. An object is an instance of a class. Suppose, we have a class Dog. Bulldog, German Shepherd, Pug are objects of the class. Creating an Object of a class. In C#, here's how we create an object of the class. ClassName obj = new ClassName(); Here, we have used the new keyword to create an object of the class
23 Φεβ 2022 · In C#, a method can return any type of data including objects. In other words, methods are allowed to return objects without any compile time error. Example 1: // C# program to illustrate the concept // of the method returning an object using System; class Example { // Private data member private string str; // Method to set the value of str public
1 Φεβ 2023 · Conditional compilation. You use four preprocessor directives to control conditional compilation: #if: Opens a conditional compilation, where code is compiled only if the specified symbol is defined. #elif: Closes the preceding conditional compilation and opens a new conditional compilation based on if the specified symbol is defined.
Everything in C# is associated with classes and objects, along with its attributes and methods. For example: in real life, a car is an object. The car has attributes, such as weight and color, and methods, such as drive and brake. A Class is like an object constructor, or a "blueprint" for creating objects.
C# doesn't use #include. All of the classes in all of the files are automatically available everywhere. If a class is created inside the same project namespace then it can be used everywhere. If it's in a different namespace you 'include' it with the "using" keyword.