Stylesheet

Image
import * as React from 'react'; import styles from './Employeespotlight.module.scss'; import { IEmployeespotlightProps } from './IEmployeespotlightProps'; import { escape } from '@microsoft/sp-lodash-subset'; import * as $ from 'jquery'; import { WebPartContext } from '@microsoft/sp-webpart-base'; import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http'; import { SliderHelper } from './Helper'; export interface SpotlightDetails { userDisplayName: string; userEmail: string; userProfilePic: string; description: string; designation?: string; } export interface IStateEmployeeSlider { value:SpotlightDetails[]; } var result=[]; export interface ResponceDetails { title: string; id: string; } export default class Employeespotlight extends React.Component { private defaultProfileImageUrl: string = "/_layouts/15/userphoto.aspx?size=L"; private helper: SliderHelper = new SliderHe...

DIFFERENCE BETWEEN STRING AND STRING BUILDER IN C#:

 

Posted by Ganesan - +919042710472  


                     DIFFERENCE BETWEEN STRING AND STRING BUILDER IN C#:

STRING:  String is immutable, which means once you create an instance of string you cannot change the string's value. Then this will keep the old instance and create a new instance with a new value in the memory.

Example:

String strMyValue ="Hello Visitor";  //create a new string instance instead of changing the old one.

strMyValue +="How Are";

strMyValue +="you?";

STRINGBUILDER:  String builder is mutable, it means if you change the value of string using string builder, it will not create a new instance, instead .it will update the value in the existing instance.

Example:

StringBuilder SbMyValue =new stringBuilder(" ");

Sb MyValue.Append("Hello Visitor");sss

Sb MyValue.Append("How Are You?");

String strMyValue= sbMyvalue. Testing();

NAMESPACE

STRING: The string class in the System namespace.

STRING BUILDER: The string builder class is in the system.Text namespace.

PERFORMANCE

STRING: Slow as compared to string Builder

STRING BUILDER:  Fast, as compared to string like it, is faster than string while concatenating many strings together in a loop.

THREAD SAFETY

STRING: Thread-safe

STRING BUILDER: Not thread-safe

SYNCHRONIZATION

STRING: Provides synchronization

StringBuilder: It does not provide synchronization 

MEMORY USAGE

STRING: Requires more, memory to create a new instance if operations performed on string change its value.

STRING BUILDER: It requires less memory as it updates the existing instance.

NATURE OF OBJECT

STRING: Object of the string is read-only nature

STRING BUILDER: The object of string builder is dynamic in nature.

EFFICIENCY

STRING: String class is less efficient as compared to StringBuilder while working with a large number of string concatenations.

STRING BUILDER: String Builder is more efficient as compared to string while working with a large number of string concatenations. 



Article by Maria Academy




Comments

Popular posts from this blog

Stylesheet