TRENDING NOW

no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
In C#, types are divided into two categories:
  • value types 
  • Reference types. 
Value types directly contain their data, and reference types store references to their data. The third category of types called pointers is available only in unsafe code. This pointer type will not be discussed in this document.

VALUE TYPES

In C#, a value type can be either a Struct or an enumeration. C# contains a set of predefined Struct types called the simple types. These simple types are identified through reserved words. All value types implicitly inherit from a class called object. Also, no type can derive from a value type. It is not possible for a value type to be null (null means “nothing” or “no value”). Assigning a variable of a value type creates a copy of the value. This is different from assigning a variable of a reference type, which copies the reference and not the object identified by the reference.

Example

Int,char,byte,bool,decimal ,double, enum , long ,sbyte,short ,struct,uint ,ulong ,ushort

REFERENCE TYPES

A reference type is one of the following: a class, an interface, an array, or a delegate. A reference type value is a reference to an instance of the type. null is compatible with all reference types and indicates the absence of an instance.

Class Types

A class defines a data structure containing data members (constants and fields), function members (methods, properties, events, indexers, operators, instance constructors, destructors and static constructors), and nested types.

The Object Type

The object class type is the ultimate base class of all other types. Every type in C# directly or indirectly derives from the object class type.

The String Type

The string type inherits directly from the class object.

Interface Types

An interface defines a contract. A class implementing an interface must adhere to its contract.

Array Types

An array is a data structure containing a number of variables that are accessed through indices. The variables contained in an array are called the elements of the array. They are all of the same types, and this type is called the element type of the array
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
In C#, a variable represents a storage location. A variable has a type that determines what values can be stored in this variable. Because C# is a type-safe language, the C# compiler guarantees that values stored in variables are always of the appropriate type.

 The value of a variable is changed through the assignment operator and through the use of the ++ and -- operators. A variable must be definitely assigned before its value can be obtained: variables are either initially assigned or initially unassigned. An initially assigned variable has a well-defined initial value, while an initially unassigned variable has no initial value.
Variables In C#

CATEGORIES OF VARIABLES IN C#

C# has seven categories of variables: static variables, instance variables, array elements, value parameters, reference parameters, output parameters, and local variables. The following sections describe each of these categories.

Static Variables

A variable, declared with the static keyword, is a static variable. The initial value of a static variable is the default value of the variable’s type. A static variable is initially assigned.

Instance Variables

A variable declared without the static keyword is an instance variable. An instance variable of a class exists when a new instance of that class is created and ceases to exist when there are no references to that instance and the instance’s destructor (if any) has executed. The initial value of an instance variable of a class is the default value of the variable’s type. An instance variable of a class is initially assigned.

Array Elements

Array elements exist when an array instance is created and cease to exist when there are no references to that array instance. The initial value of each of the elements of an array is the default value of the type of the array elements. An array element is initially assigned.

Local Variables

A local variable is declared within a block, a for-statement, a switch-statement, or a using-statement. The lifetime of a local variable is implementation-dependent. For example, the compiler could generate code that results in the variable’s storage having a shorter lifetime than its containing block. A local variable is not automatically initialized and it has no default value. A local variable is initially unassigned. It is a compile-time error to refer to the local variable in a position that precedes its declaration.

Value Parameters

A parameter declared without a ref or out modifier is a value parameter. A value parameter is initially assigned.

Reference Parameters

A parameter declared with a ref modifier is a reference parameter. A reference parameter represents the same storage location as the variable given as the argument in the function member invocation. Therefore, the value of a reference parameter is always the same as the underlying variable. A variable has to be definitely assigned before it can be passed as a reference parameter in a function member invocation. A reference parameter is considered initially assigned to a function member.

Output Parameters

An output parameter is a parameter declared with an out modifier. An output parameter represents the same storage location as the variable given as the argument in the function member invocation. Therefore, the value of an output parameter is always the same as the underlying variable. A variable does not need to be definitely assigned before it can be passed as an output parameter in a function member invocation. An output parameter is initially unassigned within a function member.

no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
In this Article am describing how to integrate SMS API in C#  that can send SMS to your mobile phone within Pakistan.
 First go to this website and signup here

Here are the simple Steps that you follow  :

  1. First Launch a visual studio 
  2. Create a console Application in visual studio 
  3. After that first added assembly reference into your project

using System.Net;
using System.Web;
Here is Implementation

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string MyUsername = "xxxx"; //Your Username At Sendpk.com 
            string MyPassword = "xxxx"; //Your Password At Sendpk.com 
            string toNumber = "xxxxx"; //Recepient cell phone number with country code 
            string Masking = "Tech Spider"; //Your Company Brand Name 
            string MessageText = "Application Done";
            string jsonResponse = SendSMS(Masking, toNumber, MessageText, MyUsername, MyPassword);
            Console.Write(jsonResponse);
            //Console.Read(); //to keep console window open if trying in visual studio 
            Console.ReadLine();
        }
        public static string SendSMS(string Masking, string toNumber, string MessageText, string MyUsername, string MyPassword)
        {
            String URI = "http://Sendpk.com" +
            "/api/sms.php?" +
            "username=" + MyUsername +
            "&password=" + MyPassword +
            "&sender=" + Masking +
            "&mobile=" + toNumber +
            "&message=" + Uri.UnescapeDataString(MessageText); // Visual Studio 10-15 
          
            try
            {
                WebRequest req = WebRequest.Create(URI);
                WebResponse resp = req.GetResponse();
                var sr = new System.IO.StreamReader(resp.GetResponseStream());
                return sr.ReadToEnd().Trim();
            }
            catch (WebException ex)
            {
                var httpWebResponse = ex.Response as HttpWebResponse;
                if (httpWebResponse != null)
                {
                    switch (httpWebResponse.StatusCode)
                    {
                        case HttpStatusCode.NotFound:
                            return "404:URL not found :" + URI;
                            break;
                        case HttpStatusCode.BadRequest:
                            return "400:Bad Request";
                            break;
                        default:
                            return httpWebResponse.StatusCode.ToString();
                    }
                }
            }
            return null;
            
        }
    
    }
   
    }
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Definition 

A frame diagram is a generic problem diagram capturing such a problem pattern is called a frame.

Instead of writing problem diagrams from scratch for every problem world we need to delimit, we might predefine a number of frequent problem patterns. A specific problem diagram can then be obtained in matching situations by instantiating the corresponding pattern (Jackson, 2001). This is another illustration of the knowledge reuse technique 

Explanation 

The interface labels are now typed parameters; they are prefixed by 'C''E' or 'Y', depending on whether they are to be instantiated to casual, event or symbolic phenomena, respectively. 


A generic component in a frame diagram can be further annotated by its type:

Causal Component

A component marked by a 'C', has some internal causality that can be enforced, e.g. it reacts predictably in response to external stimuli. A machine component is intrinsically causal. 

Biddable Component

 A  component marked by a 'B', has no such enforceable causality, e.g. it consists of people.

Lexical Component

A component, marked by an 'X', is a symbolic representation of data.

The upper part shows two frame diagrams. The one on the left-hand side represents the Simple Workpieces frame. It captures a problem class where a machine is a tool allowing a user to generate information that can be analysed and used for other purposes. The frame diagram on the right-hand side represents the Information Display frame. It captures a problem class where the machine must present information in a required form to environment components

The frame diagram specifies that the information machine component monitors a causal phenomenon C1 from the RealWorld component and produces an event phenomenon E2 for a Display component as a result. The requirement constraining the latter component is a generic accuracy requirement, as indicated by the ' .....,• symbol; it prescribes that the information displayed should accurately reflect a causal phenomenon C3 from the RealWorld component. 
Frame Diagram

The lower part shows corresponding frame instantiations yielding problem diagrams. The phenomenon instantiations, compatible with the corresponding p~rameter type, are shown on the bottom. The component instantiations, compatible with the corresponding Component type, are annotated with the name of the generic component to indicate their role in the frame instantiation. For example, the instantiated right-hand side requirement states that the notified meeting date and location must be the one determined by the Scheduler component.

Other frames can be similarly defined and instantiated, for example for problems where the environment behaviours must be controlled by the machine in accordance with commands issued by an operator, or for problems where the machine must transform input data into output data (Jackson, 2001).

Context and problem diagrams provide a simple, convenient notation for delimiting the scope of the system-to-be in terms of components relevant to the problem world and their static interconnections. There is a price to pay for such simplicity. The properties of the interaction between pairs of components are not made precise. The granularity of components and the criteria for a component to appear in a diagram are not very clear either. 


For example

A network component might be part of the problem world of scheduling meetings involving participants who are geographically distributed. According to which precise criteria should this component appear or not. Problem diagrams may also become clumsy for large sets of requirements. 

How do we compose or decompose them? What properties must be preserved under composition or decomposition? we will come back to those issues. A more precise semantics will be given for components and connections, providing criteria for identifying and refining components and interconnections. We will also see there how the / useful view offered by context and problem diagrams can be derived systematically from goal diagrams.



Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Problem diagrams

A context diagram can be further detailed by indicating explicitly which component controls a shared phenomenon, which component constitutes the machine we need to build, and which components are affected by which requirements. The resulting diagram is called a problem diagram (Jackson, 2001).

A problem diagram excerpt for the meeting scheduling system. A rectangle with a double vertical stripe represents the machine we need to build. A rectangle with a single stripe represents a component to be designed. An interface can be declared separately; the exclamation mark after a component name prefixing a declaration indicates that this component controls the phenomena in the declared set.

 For example

 The f label declaration  states that the Scheduler machine controls the phenomena determineDate and determineLocation. A dashed oval represents a requirement. It may be connected to a component through a dashed line, to indicate that the requirement refers to it, or by· a dashed arrow, to indicate that the requirement constrains it. Such connections may be labelled as well to indicate which corresponding phenomena are referenced or constrained by the requirement. 
problem diagram

For example

 The h label declaration  indicates that the requirement appearing there constrains the phenomena Date and Location controlled by the Scheduler machine.
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Definition
A context diagram is a simple graph where nodes represent system components and edges represent connections through shared phenomena declared by the labels (DeMarco, 1978; Jackson, 2001).

For example

The Initiator component controls the meetingRequest event, whereas the Scheduler component monitors it; the Scheduler component controls the constraintsRequest event, whereas the Participant component controls the constraintsSent event.

context diagram
A component in general does not interact with all other components. A context diagram provides a simple visualization of the direct environment of each component; that is, the set of 'neighbour' components with which it interacts, together with their respective interfaces.
no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
You can redefine or overload most of the built-in operators available in C#. Thus a programmer can use operators with user-defined types as well. Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. similar to any other function, an overloaded operator has a return type and a parameter list.

For example:

using System;
public class Program
{
 int x, y, z;
 public Program()
 {
 x = y = z = 0;
 }
 public Program(int i, int j, int k)
 {
 x = i;
 y = j;
 z = k;
 }
 public static Program operator +(Program a, Program b)
 {
 Program c = new Program();
 c.x = a.x + b.x;
 c.y = a.y + b.y;
 c.z = a.y + b.y;
 return c;
 }
 public static Program operator -(Program a, Program b)
 {
 Program c = new Program();
 c.x = a.x - b.x;
 c.y = a.y - b.y;
 c.z = a.y - b.y;
 return c;
 }
 public void show()
 {
 Console.WriteLine(x + " , " + y + " , " + z);
 }
}
class second
 {
 static void Main(string[] args)
 {
 Program n1 = new Program(1,2,3);
 Program n2 = new Program(10,10,10);
 Program n3 = new Program();
 Console.WriteLine("here is n1");
 n1.show();
 Console.WriteLine("here is n2");
 n2.show();
 n3 = n1 + n2;
 Console.WriteLine("Result of n1 + n2");
 
 n3.show();
 n3 = n1 + n2+n3;
 Console.WriteLine("Result of n1 + n2 + n3");
 n3.show();

 n3 = n3 - n1;
 Console.WriteLine("Result of n3 - n1");
 n3.show();
 n3 = n3 - n2;
 Console.WriteLine("Result of n3 - n2");
 n3.show();

 }
 }
no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Definition :

 Inconsistencies are the rule that  violate a consistency rule that links them explicitly or implicitly.

Types of inconsistency

Different types of consistency rule define different types of inconsistency: 


  • Terminology clash
  • Designation clash 
  • Structure clash
  • Strong conflict
  • Week conflict

Terminology clash

 The same concept is given different names in different statements.  For example, one statement states some condition for 'participating' in a meeting whereas another statement states an apparently similar or related condition for 'attending' a meeting. 

Designation clash

The same name designates different concepts in different statements. For example, one stakeholder interprets 'meeting participation' as full participation until the meeting ends, whereas another interprets it as partial participation. 

Structure clash

The same concept is given different structures in different statements. For example, one statement speaks of a participant's excluded dates as 'a set of time points', whereas another speaks of it as 'a set of time intervals'

Strong conflict

 There are statements that cannot be satisfied when taken together; their logical conjunction evaluates to false in all circumstances. This amounts to classical inconsistency in logic. In our meeting scheduler, there would be a strong conflict between one statement stating that 'the constraints of a participant may not be disclosed to anyone else' and another stating that 'the meeting initiator should know the participants' constraints'. (Those statements might originate from stakeholders having the participant's and initiator's viewpoint, respectively.) 

Weak conflict or divergence. There are statements that are not satisfiable together under some condition. This condition, called a boundary condition, captures a particular combination of circumstances that makes the statements strongly conflicting when it becomes true. The boundary condition must be feasible; that is, it can be made true

Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Q No. 1 Write a program that takes a quadratic equation as input and return whether it has two distinct roots, a double root, or not roots Using if else Condition.

Solution:
1

Q No.2  write a program that reads a number, check if this number is divisible by 4 then display “OK”, otherwise display “ failure “.


Solution.

Q No.3 Write a program to display alphabet pattern like 'U' with an asterisk.
Solution:


Q No.4 Create a program to ask the user for a symbol and answer if it is a (lowercase) vowel, a digit, or any other symbol, using "switch".

Solution:

 
Q No.5 write an application that keeps track of our grocery list. It should save our grocery needs into an array, and then print the grocery list out for us when we run the application
 "eggs", "milk", "bread", "bananas", "cereal", "rice", "yogurt"

Solution:


no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Make a program that associates all 26 English alphabets A-Z with the index 1-26. User will enter a number from 1 to 26 and it will show the associated alphabet.

Solution:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace alpha
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter Number");
            while (true)
            {

                int number = Convert.ToInt32(Console.ReadLine());
                char[] alpha = { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };

                if (number > 0 && number <= 26)
                {
                    for (int i = 1; i <= alpha.Length; i++)
                    {
                        if (i == number)
                        {
                            Console.WriteLine(alpha[i].ToString());
                        }
                    }

                }
                else
                {
                    Console.WriteLine("Invalid input");
                }

            }
            Console.ReadLine();
        }
    }
}


no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Create a new C# project and create a program that assigns values to the specific variables after checking that whether the input is integer, float, signed or unsigned.

Solution:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace alphabet
{
    class Program
    {
        static void Main(string[] args)
        {

            string a;
            Console.WriteLine("Enter the a");
            int result1;
            float result2;

            a = Console.ReadLine();

            if (int.TryParse(a, out result1) == true)
            {
                Console.WriteLine("Moved to int");

            }
            else if (float.TryParse(a, out result2) == true)
            {
                Console.WriteLine("Moved to float");
            }

            Console.ReadLine();
        }

    }

}

no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
Write a program for a calculator that will be able to perform addition, subtraction, multiplication and division. Make a main menu. It should take float values from user as inputs and display outputs as a string after performing selected operation.

Solution:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace calculator
{
    class Program
    {
        static void Main(string[] args)
        {
            float a, b,c, result;
            Console.WriteLine("Add Sub Mult Div\n ");
            Console.WriteLine("Enter the a");
                a = float.Parse(Console.ReadLine());
            Console.WriteLine("Enter the b");
            b = float.Parse(Console.ReadLine());
            Console.WriteLine("1 for Add\n 2 for Sub\n 3 f0r Mult\n 4 for Div\n ");
            Console.WriteLine("Enter the c");
            c = float.Parse(Console.ReadLine());
           
            if (c==1)
            {
                result= a + b;
                Console.WriteLine(result);
            }
            if (c==2)
            {
                result = a - b;
                Console.WriteLine(result);
            }
            if (c==3)
            {
                result = a * b;
                Console.WriteLine(result);
            }
            if (c==4)
            {
                result = a / b;
                Console.WriteLine(result);

            }
            Console.ReadLine();

           

        }
    }
}



Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc
The calculator is a type of electronic device used to do mathematical calculations. Originally, it can only executes the basic mathematical functions such as addition, subtraction, multiplication and division. The advancement of technology led to the development of Handheld Scientific Calculators and Online Scientific Calculators.

Online Scientific Calculators

A scientific calculator is a handheld calculator that is designed to solve problems in the field of sciences, mathematics, engineering and more. The remarkable change in the technology because of the advent of the internet gave birth to online scientific calculators. Calculations can now be performed for free on the internet without the need of buying a handheld scientific calculator device. The Online Scientific Calculator is a very essential tool because it can do all sorts of complex mathematical calculations very quickly as long as there is an internet connection. It is very easy to take advantage of its uses anywhere for free because it can be used as long as connected to the internet via Data, Wi-Fi or any other internet connection using a desktop, laptop, tablet or smart phone. Moreover, it is very user-friendly. Its interface is the same as the handheld calculator.

Online Scientific Calculator help lessen the difficulty of answering problems and for both students and professionals alike. Accurate calculations can be brought out by using this great online tool. Mathematical problems can be solved repeatedly quickly and without any difficulty. Thus, it is a great instrument for developing new technologies for students, engineers, scientists, and more.

Free Online Scientific Calculator is available for fast and easy solving of problems, which helps in saving time for both students and professionals. One best Online Scientific Calculator is  Scientific Calculator from EEweb. eCalc is a free and easy to use scientific calculator that supports many advanced features including unit conversion, equation solving, and even complex-number math. eCalc is offered as both a free online calculator and as a downloadable calculator.


no image
Place where all sort of programming stuff and reviews,technology news are shared and Useful Project of C++,C,java C# etc

This is the simple program for twitter post analysis in this program analysis latest tweet on twitter 

Note: First Install Library tweepy into your PC than run it

Program :

import tweepy
from textblob import TextBlob
consumer_key='t4kfKNpNLojrcLD5BQVJsZ6FV'
consumer_secret='izwKDPBjeZAUCcKFjhU9F7EUFYVQaieTSMsSg0cJLb3zNcbNhW'
access_token='2444042389-BLj6mrSj2k1HfGWnJMDAp92yXmIuPjGwitZ8NHk'
access_token_secret='jvcDI5GjW69tteEG816e4OA1wpOR04hz277mmqUnO9hQT'
auth=tweepy.OAuthHandler
auth=tweepy.OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_token,access_token_secret)
api=tweepy.API(auth)
public_tweets=api.search('@twitterusername') #like Zubairsaif700
for tweet in public_tweets:
    print(tweet.text)
    analysis=TextBlob(tweet.text)
    print(analysis.sentiment)