Skip to main content

Posts

Extension Class and Method in C#

 In C#, extension methods allow you to "add" methods to existing types without modifying the original type or using inheritance. These methods are defined in a static class , and the method itself must also be static , with the first parameter preceded by the this keyword to indicate the type it's extending. 🔹 Syntax of Extension Method csharp public static class ExtensionClass { public static returnType MethodName ( this TypeToExtend obj, other parameters) { // method body } } 🔹 Example 1: Extension Method on string Type csharp // Extension class public static class StringExtensions { public static int WordCount ( this string str) { if ( string .IsNullOrWhiteSpace(str)) return 0 ; return str.Split( ' ' ).Length; } } // Usage class Program { static void Main () { string msg = "Hello from TechForest Software" ; int count = msg.WordCount(); // ...

Lambda , S3 Integration

 Lambda , S3 Integration: Lambda : it is server-less  service to perform dynamic operation under multiple S3 Services . it provide set of methods and API to communicate with various services without using resource. Task 1: Connect S3 to lambda to show bucket name, filename and file content when we upload file into s3: 1)  Edit Existing Role of Lambda with S3 { "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Action": [ "s3:GetObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::s3lambdapracticeindore/*" ] } ] } 2)  Code of S3 method to display content of S3 bucket file: import json import boto3 import os def lambda_handler ( event , context ):     bucket_name = event[ 'Records' ][ 0 ][ 's3' ][ 'bucket' ][ 'name' ]     object_key = event[ 'R...

Python Interview Question and Answer

Python Interview Question and Answer HR Round Interview Question: 1) Can you walk us through your background and how it led you to this role? 2) What motivates you to join our company? 3) How do you handle a situation where you disagree with your manager? 4) Describe a time you went above and beyond in your role. 5). How do you manage stress and tight deadlines? 6) What are your strengths and areas for improvement? 7) How do you stay updated with the latest technologies and industry trends? Technical Interview Question: 1. How does Python handle memory management and garbage collection? Answer : Python uses reference counting to track object references and a cyclic garbage collector to handle circular references. When an object’s reference count drops to zero, it’s deallocated. The gc module detects cycles using a mark-and-sweep algorithm. Example : import gc class Node : def __init__ (self): self. next = None node1, node2 = Node(), Node() node1. next , node2. next = no...

Top 100 Salesforce Interview Question

Top 100 Salesforce Interview Question  🧠 General & Conceptual Questions 1. What is Salesforce? 2. What is CRM, and how does Salesforce implement it? 3. Differentiate between Salesforce.com and Force.com. 4. What are the different types of clouds in Salesforce? 5. Explain the Salesforce architecture. 6. What are the different editions of Salesforce? 7. What is the AppExchange? 8. What is a sandbox? What are its types? 9. What is metadata in Salesforce? 10. What are Governor Limits? 🔐 Security & Access Control 11. What is a Profile? 12. What is a Role? 13. Differentiate between Profiles and Roles. 14. What are Permission Sets? 15. What is a Permission Set Group? 16. What is Field-Level Security? 17. What is Organization-Wide Default (OWD)? 18. What are Sharing Rules? 19. What is Manual Sharing? 20. What is the Role Hierarchy? 🧱 Data Modeling 21. What are Standard and Custom Objects? 22. What is a Record Type? 23. What is a Page Layout? 24. What is a Compact Layout? 25. Wha...

Code First Approach in .NET Core MVC

Code First Approach in ASP.NET Core MVC? Code First is complete dynamic approach of entity framework where we create database configuration and table dynamically using dB Context class.  1)  Create Web Project using ASP.NET Core MVC Project Template 2)  Add Library from Nuget Package EntityFrameworkCore.Design EntityFrameworkCore.SQLServer EntityFrameworkCore.Tools 3) Create Local Database using Server Explorer 4)  Create Model Class Like this using System.ComponentModel.DataAnnotations; namespace WebApplication3.Models {     public class Employee     {         [Key]         public int Id { get; set; }         public string Name { get; set; }             public string Email { get; set; }         public string Mobileno { get; set; }     } } 5)  Create DbContext class using Microsoft.EntityFrameworkCore; namespace WebAppl...